03-12-2008, 09:49 AM
|
#7 (permalink)
|
|
The Contributor
Join Date: Jan 2008
Location: Brazil
Posts: 77
Thanks: 14
|
The value property of each checkbox should be set to the actual id of each item, and not to an array (id[]).
HTML Code:
<input type="checkbox" name="checkbox[]" value="<?= $id ?>" />
That $id will probably come from your database as you build the list of items.
To process the form data you use $_POST['checkbox'][$i]:
PHP Code:
for ($i = 0; $i < count($_POST['checkbox']); ++$i) {
echo "item id: " . $_POST['checkbox'][$i];
}
I tested it here, this is the right way to do it. 
|
|
|