Assigning array values through a form

A

Anonymous

Guest
babyfighter said:
I have an array called $SeqParts. When I pass this array to "print_r" I get:

Array ( [0] => 101742 [1] => BUSH-JA [2] => G3-214 )

I'm sending an HTML form and I need to send to post the array to the next page. Here is what I am currently trying:

<INPUT TYPE="hidden" NAME="SeqParts[]" VALUE= '<?php print $SeqParts; ?>'>

Of course this doesn't work. How would I correctly post the array?

thanks.

Firstly you're using the input name as SeqParts[]. This would cause the value to become one array key of the variable $SeqParts on the next page. Try changing this to just SeqParts.

Alternatively, if your array is a simple $key => $value array (ie none of the values themselves are arrays), I would recomment assigning each one of them their own input field, but put the name as SeqParts[] because you want them to be available as an array when the form is sent
 
Back
Top