Re: how can php get the values of a group of checkbox
| From: | Ernest E Vogelsinger | Date: | Thu, 21 Nov 2002 19:23:29 +0000 |
| Subject: | Re: how can php get the values of a group of checkbox | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-125468@lists.php.net to get a copy of this message | ||
At 20:14 21.11.2002, Xin Qi said:
--------------------[snip]--------------------
>if i have a group of checkboxes, and they have the SAME name, when they are
>submited into a php script, how can this php file get the value of each
>checkbox?
>
>since they have the same name, $_GET["checkbox_name"] only returns the last
>one.
--------------------[snip]--------------------
If you name your checkboxes "checkbox_name[]" (note the brackets behind the
name) PHP will recognize the parameters being an array so you will have all
(checked) values at your disposal.
For checkboxes this means that _unchecked_ options are NOT transmitted.
Might be a caveat depending on your implementation.
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/