passing arrays between pages

From: Date: Tue, 04 Jul 2000 16:21:51 +0000
Subject: passing arrays between pages
Groups: php.general 
Request: Send a blank email to php-general+get-4769@lists.php.net to get a copy of this message
Hi all I'm having a problem passing a multidimentional array between pages. The below example returns Newarr is of type boolean Newarr[0] is of type NULL Newarr[1] is of type NULL Newarr[0][0] is Newarr[0][1] is Newarr[1][1] is Newarr[1][2] is The code I'm using to test is as follows <?php if( !isset($passarr) ) { $arr[0][] = 'One'; $arr[0][] = 'Two'; $arr[0][] = 'Three'; $arr[1][] = 'Four'; $arr[1][] = 'Five'; $arr[1][] = 'Six'; $passarr = urlencode(serialize($arr)); echo "<a href=\"$PHP_SELF?passarr=$passarr\">Send array</a>"; } else { $newarr = unserialize(urldecode($passarr)); echo 'Newarr is of type ' . gettype($newarr) . '<br>'; echo 'Newarr[0] is of type ' . gettype($newarr[0]) . '<br>'; echo 'Newarr[1] is of type ' . gettype($newarr[1]) . '<br>'; printf("Newarr[0][0] is %s<br>",$newarr[0][0]); printf("Newarr[0][1] is %s<br>",$newarr[0][1]); printf("Newarr[1][1] is %s<br>",$newarr[1][1]); printf("Newarr[1][2] is %s<br>",$newarr[1][2]); } ?> The TRACK-VARS variable according to phpinfo is on. So what am I missing here? Thanks in advance for any suggestions. Regards Nick

« previous php.general (#4769) next »