form - 在foreach循环中输出空复选框(数组)(PHP)

I got a problem & don't get the solutions, hope you can help me!

I created a form which have visitors with optional a guest. The sense of the form is to delete the visitor and the guest. Now you got some options:

  1. Delete the visitor and the guest
  2. Delete only the visitor
  3. Delete only the guest

Here are my checkboxes in a while-loop:

while ($row = mysql_fetch_array($result_loeschen)) 
{
echo "<td class='disable'><input type='text' name='AnmeldungID[]' value=".$row[ID]."></td>";    
echo "<input type='hidden' name='option[0]' value='0' />";
echo "<td><input type='checkbox' name='option[0]' value='1' /></td> ";

echo "<input type='hidden' name='option[1]' value='0' />";
echo "<td><input type='checkbox' name='option[1]' value='2' /></td> ";

echo "<input type='hidden' name='option[2]' value='0' />";
echo "<td><input type='checkbox' name='option[2]' value='3' /></td> ";
}

After the form is send:

foreach($_POST['AnmeldungID'] as $key => $ID) { 
    $option = $_POST['option'][$key];

    echo $ID;
    echo " = ";
    echo $option;
    echo "<br />";
    }

But it does not work, if all are checked - the output is:

19 = 1 12 = 0 14 = 0 15 = 0

Any ideas? Thanks! Chris

You can just set the name to option[] in every checkbox.

Maybe radiobuttons are the better choice for your goal?