haku87 Posted April 22, 2007 Share Posted April 22, 2007 Is there a way to get a two dimension hidden field? One dimension <input name = "test[]" type = "hidden"> Is there such thing as <input name = "test[1][]" type = "hidden"> Ande Link to comment https://forums.phpfreaks.com/topic/48131-two-dimension-hidden-field/ Share on other sites More sharing options...
paul2463 Posted April 22, 2007 Share Posted April 22, 2007 have a look here <a href="http://www.zend.com/code/codex.php?id=182&single=1"> Courtesy of Zend </a> might answer your question Link to comment https://forums.phpfreaks.com/topic/48131-two-dimension-hidden-field/#findComment-235208 Share on other sites More sharing options...
haku87 Posted April 22, 2007 Author Share Posted April 22, 2007 Hi, the example link is down. Any other example. I was trying to submit a two dimension hidden field to another page. Link to comment https://forums.phpfreaks.com/topic/48131-two-dimension-hidden-field/#findComment-235218 Share on other sites More sharing options...
jchemie Posted April 22, 2007 Share Posted April 22, 2007 well since the link was down for you i have copied the code here... FROM THE SITE takes a multidimensional array and puts all the elements into HTML hidden input types so data can be carried through to another page <?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; } } ?> Link to comment https://forums.phpfreaks.com/topic/48131-two-dimension-hidden-field/#findComment-235242 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.