Re: Checkbox/Database Issues
| From: | Christoph Grottolo | Date: | Thu, 15 Aug 2002 19:38:43 +0000 |
| Subject: | Re: Checkbox/Database Issues | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-15285@lists.php.net to get a copy of this message | ||
Stephanie wrote:
> Here's my problem: I have a form in which there is a question and 5
> checkboxes to select from (ex: you can select more than one checkbox)
>
> I need to get each checkbox that is selected to show up when it is
> inputed into the mySQL DB.
>
> I can get the first selected checkbox in, but nothing I've done seems
> to work.
You must use something like this in the HTML form:
<input type=checkbox name=myCheck[] value=1>
<input type=checkbox name=myCheck[] value=2>...
Note the square braces at the end of the name, they indicate php to populate
an array.
In PHP you should then have the array myCheck in $_GET or $_POST with the
values which have been checked.
HTH,
Christoph