Re: Question: Checkboxes & Variables
| From: | cnb | Date: | Mon, 10 Jul 2000 11:21:57 +0000 |
| Subject: | Re: Question: Checkboxes & Variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-5685@lists.php.net to get a copy of this message | ||
use
<input type="checkbox" name="foo[1]"> choice 1
<input type="checkbox" name="foo[2]"> choice 2
...
etc
and you'll get the data in an global array called foo in your PHP script.
nifty feature right? :>
Convenient to use in loops.
- cnb.
On Sun, 9 Jul 2000, Daniel Murillo wrote:
> I am trying to create a form with checkboxes where individuals can select as
> many checkboxes as they wish and get results depending on what they checked.
> (I.E., If a person selects a checkbox marked "ball" and a checkbox marked
> "spike" then the next page will display results that match either "ball" or
> "spike".) The problem is that I cannot give each individual checkbox its
> own specific name because then I would have to create a loop to see which
> variables have been given a value, which would be too time intensive since
> the number of checkboxes available would be around 20. Now, since every
> checkbox has the same name, with each clicking of a new checkbox it
> overwrites the previous value that was assigned to that variable (duh). I am
> wondering if there is a way to append the checkbox values to the variable or
> if there is possibly some easier way to do this that I am missing.
>
> thanks,
>
> Daniel Murillo
> damurillo@amherst.edu
>
>
>
>
--
Chandrashekhar Bhosle. Email: cnb@freeos.com
Webmaster. ICQ : 7616948
FreeOS.com - The Resource Center for Free Operating Systems.
------------------------------------------------------------