Forum Moderators: coopster

Message Too Old, No Replies

Passing Array contents in a hidden input tag

Can't get array results

         

gms3651

11:35 pm on Jan 27, 2007 (gmt 0)

10+ Year Member



Hello,
I have a page that stores checkbox entries into an array. The name of that form element is sizes[]. Upon submission of the form the sizes[] get sent as $_POST['sizes'] to anothe page. I then store the array information into a hidden input type:

<input type="hidden" name="anothersize[]" value="<?= $_POST[sizes]?>" />

Because this is going to be sent to another page upon submisssion on the second form. The third page then should process the information within the array. However, the contents is not in the array anymore. The following code only ouputs the size ID in Array.

$asize = $_POST['anothersize'];
foreach ($asize as $sizeID)
{ echo "The Size ID is $sizeID<br>";
}

This makes me wonder if I can't store the array contents into a hidden input type in a different form.

Any help would be appreciated.

Little_G

12:44 am on Jan 28, 2007 (gmt 0)

10+ Year Member



Hi,

Take a look at this very useful function, serialize [php.net].

Andrew