Re: Q: How to get the value of a checkbox of which name without '[]'?
| From: | CPT John W. Holmes | Date: | Mon, 18 Aug 2003 20:06:05 +0000 |
| Subject: | Re: Q: How to get the value of a checkbox of which name without '[]'? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-159944@lists.php.net to get a copy of this message | ||
> Consider the following form in a HTML file:
>
> ...
> <input type=checkbox name="box" value=1>
> <input type=checkbox name="box" value=2>
> <input type=checkbox name="box" value=3>
> <input type=checkbox name="box" value=4>
> ...
>
> Now I'm posting this form into a PHP script. The problem is I can't
change
> that HTML file. Which means I can't modify the code above into PHP
prefered
> style:
>
> <input type=checkbox name="box[]" value=1>
> <input type=checkbox name="box[]" value=2>
> ...
>
> So, how can I get the correct values of the checkbox? $_REQUEST['box'] is
> not an array and only contains the last value. Thanks!
Parse the value of $_SERVER['QUERY_STRING'] yourself and make the array.
---John Holmes...