Q: How to get the value of a checkbox of which name without '[]'?
| From: | Dallas Thunder | Date: | Mon, 18 Aug 2003 19:48:28 +0000 |
| Subject: | 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-159942@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!