Re: HELP with arrays and URL (easy)
| From: | Matt McClanahan | Date: | Fri, 01 Dec 2000 23:47:55 +0000 |
| Subject: | Re: HELP with arrays and URL (easy) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28322@lists.php.net to get a copy of this message | ||
On Sat, 2 Dec 2000, Dallas Kropka wrote:
> I am trying to pass an array through the URL with an echo statement,
> but all I ever get is the word Array... Im sure Im doing something
> stupid... this is what I'm doing...
>
> $arr = array ("somthing" => "here");
>
> echo"<a href=\"test2.php3?arr=$arr\">link</a>";
>
> and to view...
>
> $key = $arr[somthing];
> echo("$arr[somthing]");
This really should be a FAQ..
<?
$arr = array('something' => 'here');
$serialized = urlencode(serialize($arr));
?>
<a href="test2.php?serialized=<? echo $arr ?>">
And to get the array back..
<?
$arr = unserialize(urldecode($serialized));
?>
Matt