Re: HELP with arrays and URL (easy)
| From: | Ignacio Vazquez-Abrams | Date: | Fri, 01 Dec 2000 23:48:49 +0000 |
| Subject: | Re: HELP with arrays and URL (easy) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28323@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]");
>
>
> but all I get is either the letter A or Array.... how can I fix this?
>
> Thanks,
> Dallas K.
>
1) You can't pass arrays like that. All you'll see is "Array" because it tries
to convert an array to a string which doesn't work.
2) Put quotes around "somthing". No use using the compiler as a
crutch; do it right.
3) Try:
...?arr=".urlencode(serialize($arr))."...
and:
$arr=unserialize($HTTP_GET_VARS["arr"]);
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>