Re: problem passing variable between forms.
| From: | CPT John W. Holmes | Date: | Tue, 26 Aug 2003 13:59:47 +0000 |
| Subject: | Re: problem passing variable between forms. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-160757@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Angelo Zanetti" <binc2@ctech.ac.za>
> I have a form in which I have a table with dynamic checkboxes, they are in
a
> checkbox array ( name = chk[]...), I pass this variable to the next page
> using POST I receive the variable and use it, no problem, but then when I
> try to pass it to the next form in the URL (using an A HREF:
>
> <a href='confirmrequest.php?requested=" . $chk . "'> )
You need to serialize() the array in order to pass all of it's values.
$ser = urlencode(serialize($chk));
$url = "confirmrequest.php?requested=$ser";
Then on the receiving side...
$chk = unserialize($_GET['requested']);
You could also just add it to the session and make it easy...
$_SESSION['chk'] = $chk;
and on the receiving page:
$chk = $_SESSION['chk'];
---John Holmes...