Re: [PHP] passing arrays between pages with serialize
Thanks, I found the problem was with the creation of the 2-di array. - Original Message - From: Martin Towell [EMAIL PROTECTED] To: 'DoL' [EMAIL PROTECTED]; [EMAIL PROTECTED] 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:[EMAIL PROTECTED]] Sent: Wednesday, July 31, 2002 2:21 PM To: [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing arrays between pages with serialize
Hi Valeri Thanks for your advise. I am new to php and have never used $_SESSION, is this the one that I need to session_register the variables/arrays? Thanks again. Dominic - Original Message - From: Valeri Felberg [EMAIL PROTECTED] To: DoL [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, July 31, 2002 4:57 PM Subject: Re: [PHP] passing arrays between pages with serialize 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 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:[EMAIL PROTECTED] CZEMINSKI-STR. 1A 10829 BERLIN GERMANY FON: +49(0)30 - 768 033 93 FAX: +49(0)30 - 768 033 94 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing arrays between pages with serialize
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 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:[EMAIL PROTECTED] CZEMINSKI-STR. 1A 10829 BERLIN GERMANY FON: +49(0)30 - 768 033 93 FAX: +49(0)30 - 768 033 94 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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:[EMAIL PROTECTED]] Sent: Wednesday, July 31, 2002 2:21 PM To: [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php