Re: Check box with same name
| From: | Philip Olson | Date: | Fri, 01 Nov 2002 22:05:29 +0000 |
| Subject: | Re: Check box with same name | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122465@lists.php.net to get a copy of this message | ||
Hello,
Use an array:
<input type="checkbox" name="foo[]" value="blah">
Note:
Only checked checkboxes are passed.
Access:
print $_REQUEST['foo'][0]; // the first one
print $_REQUEST['foo'][1]; // the second
You can use named indices too:
<input type="checkbox" name="foo[bar]" value="blah">
print $_REQUEST['foo']['bar'];
Mix and match, have fun.
Regards,
Philip