Re: problem passing variable between forms.
| From: | CPT John W. Holmes | Date: | Tue, 23 Sep 2003 12:34:03 +0000 |
| Subject: | Re: problem passing variable between forms. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-163584@lists.php.net to get a copy of this message | ||
From: "Angelo Zanetti" <binc2@ctech.ac.za>
> therefore I can register this variable on the same page as the checkboxes?
> So therefore is it posssible for php to determine which checkboxes have
been
> selected (or are the ones that are selected added to the array)?
The ones that are selected are added to the array.
---John Holmes...
> ----- 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...
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>