Re: RE: passing array values in forms
| From: | Jason Wong | Date: | Mon, 06 Jan 2003 16:43:43 +0000 |
| Subject: | Re: RE: passing array values in forms | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-24596@lists.php.net to get a copy of this message | ||
On Tuesday 07 January 2003 00:23, Mignon Hunter wrote:
> This is a variation to similar string earlier. Have been checking
> books, online manuals, suggestions here - tutorials and such.
>
> Having issues passing arrays in forms. I have been working on this a few
> days and am stuck. Am trying to pass cat[] and id[] with whatever
> checkbox user checks. cat[] works fine. My id[] is hidden and am not
> able to pass correctly. cat[] will display correct item on second page
> but idid[] just passes 12 (which is the number of initial items in the
> result from query) - or it will display 1,2,3,4,5,6,7,8,9,10,11.
>
> Does anyone have suggestions. I have tried using submit hidden value
> among other variations...to no avail.
cat[] works because for each item 'in the array cat[]' you have a
corresponding checkbox. id[] doesn't work because you only have a single
hidden element. There are more than one to resolve this:
1) Have a hidden element for each id you need to pass:- id[0], id[1], etc.
2) Use sessions
3) Use serialize() on the array $id, this allows you to store the entire array
as a single hidden element. Then use unserialize() in comp_page4.php to
reconstruct $id.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Catch a wave and you're sitting on top of the world.
-- The Beach Boys
*/