Re: passing arrays between pages with serialize

From: Date: Wed, 31 Jul 2002 08:57:38 +0000
Subject: Re: passing arrays between pages with serialize
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-110479@lists.php.net to get a copy of this message
Hallo DoL, it worked when i didn't use urldecode(), just stripslashes(): page-1 $s_array1 = urlencode(serialize($array1)); header("Location: page-2?h_array1=$s_array1"); page-2 $array1 = unserialize(stripslashes($_GET["h_array1"])); The other way that worked was passing arrays in $_SESSION. You don't need even serialize them in that case. D> Hi D> I would like to pass three arrays, two of them are two dimensional arrays, D> to another page (or to the same page just submit to itself) using hidden D> field and the function serialize. D> (this is a two dimensional array) D> page-1 D> $s_array1 = serialize($array1); D> <INPUT type="HIDDEN" name="h_array1" value="<?php echo D> urlencode($s_array1); ?>>"> D> page-2 D> $array1= unserialize(urldecode(stripslashes($_POST['h_array1']))); D> it seems to work except there appears to be one NULL record added to the D> beginning of the array. D> it affects the following :- D> count(array_keys($array1) ) returns actual_no_of_keys + 1 D> foreach () echo with one NULL record at the beginning D> reset($array1) erase the array completely !! D> and it doesn't help to use rawurl(en|de)code, and with | without D> stripslashes! D> PLEASE HELP! if you can resolve this, or has a better ways to pass arrays D> between pages. D> Many Thanks D> /dl -- Mit freundlichen Grüssen Valeri Felberg [Web developer] trimfab - internet mediagroup ------------------------------------------ our mission: innovative business solutions www.trimfab.com mailto:felberg@trimfab.com CZEMINSKI-STR. 1A 10829 BERLIN GERMANY FON: +49(0)30 - 768 033 93 FAX: +49(0)30 - 768 033 94

« previous php.general (#110479) next »