Micah Gersten wrote:
You cannot have anything in the brackets for the name in a checkbox
group. The brackets specify that it is an array. The name of the array
is the key in $_POST that contains the values of the checkbox group that
were checked. You can have as many groups as you like.
Eh? Course you can.
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="checkbox" name="data[field_name][]" id="my_checkbox_1"
value="1" > Val 1
<input type="checkbox" name="data[field_name][]" id="my_checkbox_2"
value="2" > Val 2
<input type="checkbox" name="data[field2][]" id="field1" value="1" > Val
1 (Field 1)
<input type="checkbox" name="data[field2][]" id="field2" value="2" > Val
2 (Field 2)
<input type="submit">
</form>
<pre>
<?php
print_r($_POST);
You end up with a multi-dimensional array.
Array
(
[data] => Array
(
[field_name] => Array
(
[0] => 1
)
[field2] => Array
(
[0] => 1
[1] => 2
)
)
)
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php