I have a form with multiple checkboxes in an array checkbox[]
And I am using the following code to try and insert values into my db
if (isset($POST['submit'])) {
foreach ($POST['checkbox'] as $checkbox){
$cell=$checkbox[0];
$cell2=$checkbox[1];
$result = mysql_query("UPDATE *** SET match1='$cell' WHERE username='$username'");
$result = mysql_query("UPDATE *** SET match2='$cell2' WHERE username='$username'");
When I run the print_r($_POST['checkbox']) I get the following result
Array ( [0] => 1 [1] => 2 )
Which I thought would be ok, however the db is not updating as I would like, currently value of match1 is last checkbox and match2 does not have a value at all.
Can someone tell me where I have gone wrong.
Many thanks
Jon