Re: (Urgent!!!) Checkbox Reference
| From: | Brian Clark | Date: | Sun, 17 Dec 2000 06:54:33 +0000 |
| Subject: | Re: (Urgent!!!) Checkbox Reference | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30722@lists.php.net to get a copy of this message | ||
Hello Tan,
(TJ == "Tan JH") jenhwi@visto.com writes:
TJ> Can anyone tell me how to reference checkboxes which is name using
TJ> a php variable? Thanks....
Not *exactly* sure what you mean, but..
<input type="checkbox" name="test" value="foo">
$test holds the string 'foo'
<input type="checkbox" name="test[1]" value="foo">
The second element in $test holds the string 'foo'
<input type="checkbox" name="test[]" value="foo">
<input type="checkbox" name="test[]" value="bar">
$test is comprised of two elements.
while(list($key,$value) = each($test)
{
print "$key : $value<br>\n";
}
-Brian