Re: pass array
| From: | Matt McClanahan | Date: | Fri, 03 Nov 2000 03:18:20 +0000 |
| Subject: | Re: pass array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-23511@lists.php.net to get a copy of this message | ||
On Thu, 2 Nov 2000, AJDIN BRANDIC wrote:
> Hi,
>
> Is it possible to pass an array from one page to another without using
> cookies or sessions. ie. as a hidden form feild or href=blah.php3?myarray[]
> ??????
I wonder if this shouldn't be a faq entry somewhere. It comes up fairly
reguarly.
Yes, you can pass arrays between pages. To do so, you must first
serialize and urlencode the array.
Page 1:
$param = urlencode(serialize($array));
echo '<a href="page2.php?param=' . $param . '">Pass
array</a>';
Page 2:
$array = unserialize(urldecode($param));
http://www.php.net/manual/function.serialize.php
http://www.php.net/manual/function.urlencode.php
Matt