Re: POST arrays?
| From: | Stut | Date: | Thu, 20 Apr 2006 11:33:30 +0000 |
| Subject: | Re: POST arrays? | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-234352@lists.php.net to get a copy of this message | ||
William Stokes wrote:
Can someone help me to get started with serializing? I think I did'nt quite understand the manual here... How to post to $PHP_SELF and read this simple array?Why do you want to post it to itself? Why not use a session instead? It's a lot more efficient.
<? //print the posted array here print_r($arr_siirt_jouk); //create the array and post it in another name $arr_siirto = array(1,2,3); <input type="hidden" name="arr_siirt_jouk" value="<?php echo "$arr_siirto";?>"> ?> I tried: <? //print the posted array here unserialize($arr_siirt_jouk); You need to put the unserialized array somewhere, change this to$arr_siirt_jouk = unserialize($arr_siirt_jouk);
print_r($arr_siirt_jouk); //create the array and post it in another name $arr_siirto = array((serialize('1','2','3')); Here you are still putting an array into the input field. You probably want$arr_siirto = serialize(array('1','2','3'));
<input type="hidden" name="arr_siirt_jouk" value="<?php echo "$arr_siirto";?>"> ?> Which, to my great surprice, didn't work :) I was surpriced too! Is the manual really that poorly written? I can't see how you got to your code by following the examples provided.-Stut