Please Help!! I have created a mysql database then checked for duplicates, but i got some problem with array sent through a checkbox. I am trying to use foreach to call each array.
here is the form:
echo '<tr><td>'.'<input type="checkbox" name="id[]" value="'.$row['id'].'"/></td>'. // other code continues here.....
it is from mysql table named 'backup' that have 75 duplicates.
and here is my code to "catch" the the array from the checkboxes.
$delete = $POST['delete'];
$array_id = $POST['id'];
if (isset($delete) && is_array($array_id))
{
foreach ($array_id as $id)
{
echo "ID:".$array_id." %ID: ".$id."<br>";
mysql_query("DELETE FROM backup WHERE ID='$id'")or die(mysql_error());
}
}
else
{
echo "An error occurred during deletion process!<br />\n";
}
Thanks in advance!