Skip to content

Instantly share code, notes, and snippets.

@gfargo
Created November 16, 2013 16:29
Show Gist options
  • Save gfargo/7502176 to your computer and use it in GitHub Desktop.
Save gfargo/7502176 to your computer and use it in GitHub Desktop.
Returns out Array of Hidden Inputs when received in the $_POST. This function is used in conjunction with the Placester Wordpress Real Estate IDX Plugin. It's purpose is to allow the user to pass an array through the $_POST variable - as opposed to straight AJAX.
function render_post_array ($group = 'location', $key = 'postal') {
if ($_POST['location'] && is_array($_POST['location']['postal'])) {
$output = '';
foreach ($_POST[$group][$key] as $value) {
$output .= '<input type="hidden" name="'.$group.'['.$key.'][]" value="' . $value .'" >';
}
$output .= '<input type="hidden" name="'.$group.'['.$key.'][]" value="in" >';
}
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment