Re: passing arrays between pages with serialize

From: Date: Fri, 02 Aug 2002 06:26:42 +0000
Subject: Re: passing arrays between pages with serialize
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-110783@lists.php.net to get a copy of this message
Thanks, I found the problem was with the creation of the 2-di array. ----- Original Message ----- From: "Martin Towell" <martin.towell@world.net> To: "'DoL'" <dwylau@netvigator.com>; <php-general@lists.php.net> Sent: Wednesday, July 31, 2002 12:21 PM Subject: RE: [PHP] passing arrays between pages with serialize > Can you post/send the results of doing a print_r() on the first page (the > one that's serialising) and the results of the serialize()? > > -----Original Message----- > From: DoL [mailto:dwylau@netvigator.com] > Sent: Wednesday, July 31, 2002 2:21 PM > To: php-general@lists.php.net > Subject: [PHP] passing arrays between pages with serialize > > > Hi > > I would like to pass three arrays, two of them are two dimensional arrays, > to another page (or to the same page just submit to itself) using hidden > field and the function serialize. > > (this is a two dimensional array) > page-1 > $s_array1 = serialize($array1); > > <INPUT type="HIDDEN" name="h_array1" value="<?php echo urlencode($s_array1); > ?>"> > > page-2 > $array1= unserialize(urldecode(stripslashes($_POST['h_array1']))); > > it seems to work except there appears to be one NULL record added to the > beginning of the array. > it affects the following :- > count(array_keys($array1) ) returns actual_no_of_keys + 1 > foreach () echo with one NULL record at the beginning > reset($array1) erase the array completely !! > > and it doesn't help to use rawurl(en|de)code, and with | without > stripslashes! > > PLEASE HELP! if you can resolve this, or has a better ways to pass arrays > between pages. > > Many Thanks > /dl > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#110783) next »