View Single Post
Old 03-12-2008, 09:49 AM   #7 (permalink)
DeMo
The Contributor
 
DeMo's Avatar
 
Join Date: Jan 2008
Location: Brazil
Posts: 77
Thanks: 14
DeMo is on a distinguished road
Default

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.
Send a message via ICQ to DeMo Send a message via MSN to DeMo Send a message via Skype™ to DeMo
DeMo is offline  
Reply With Quote
The Following User Says Thank You to DeMo For This Useful Post:
oMIKEo (03-12-2008)