Re: Q: How to get the value of a checkbox of which name without '[]'?
| From: | Greg Beaver | Date: | Mon, 18 Aug 2003 19:58:48 +0000 |
| Subject: | Re: Q: How to get the value of a checkbox of which name without '[]'? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159943@lists.php.net to get a copy of this message | ||
You can try using $HTTP_RAW_POST_DATA and parsing it yourself - or grab
the get value directly from $_SERVER['QUERY_STRING']
Regards,
Greg
Dallas Thunder wrote:
> 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!
>