Re: passing multidimentional arrays between pages
| From: | G3 | Date: | Fri, 27 Oct 2000 00:15:01 +0000 |
| Subject: | Re: passing multidimentional arrays between pages | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22236@lists.php.net to get a copy of this message | ||
Here is some code to show you:
<?php
if($action == "send"){
$items = unserialize(urldecode($items));
while(list($k,$v) = each($items)){
echo " $k-$v<br>";
}
}else{
$items =
urlencode(serialize(array("1"=>"one","2"=>"two","3"=>"three")));
echo "
<form action=$PHP_SELF method=get>
<input type=hidden name=action value=send>
<input type=hidden name=items value=$items>
<input type=submit value=send>
</form>
";
}
?>
Nick Allan wrote:
> Hi all
> I'm having some problem passing multidimentional arrays between two php
> files.
> ie
> The array is created in search.php3 and I want to pass all its contents to
> edit.php3
> According to something I saw in the mailing list archives, I should be
> able to use serialize and unserialize. I assume I also have to urlencode
> and urldecode.
> in search.php3 I've got the following code
> $passinfo = urlencode(serialize($info));
> ?>
> <form method=post action=edit.php3?passinfo=<?echo $passinfo?>>
>
> in edit.php3 I've got
> $info = unserialize(urldecode($passinfo));
>
> according to gettype the variable $info is nolonger an array, its a
> boolean.
> I'm obviously missing something here, can anyone enlighten me on how I do
> this procedure?
>
> Thanks in advance for your help.
>
> Regards Nick
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net