<?php function array_to_hidden($array, $carry = "data") {
/* feed it a multidimensional array and it goes right down putting every
* non-blank element of every sub-array into a HIDDEN field of an HTML
* FORM. The second argument should be the name of the variable
* you've passed */
while(list($name, $value) = each($array)) {
if (is_array($value)):
array_to_hidden($value, "${carry}[$name]");
/* uncomment the "elseif" if you don't want fields with blank values to be
* passed along. (don't forget to comment out the else of course!) */
//elseif (!ereg("^[ nt]*$", $value)):
else:
echo "n<INPUT TYPE="hidden" NAME="${carry}[$name]" ",
"VALUE="$value">";
endif;
}
}
?>
|
|