I have the code below which loops through selected checkboxes and executes and sql statement.
if (isset($_POST['delete']))
{
for($i=0;$i<$recordcount;$i++)
{
$deleteid = isset($_POST['checkbox'][$i]);
echo "ID = ".$deleteid."<br />"; //Error checking
$sqldelete = "DELETE FROM customer WHERE cus_ID = ".$deleteid."";
echo $sqldelete."<br />"; //Error checking
$deleters = $conn->Execute($sqldelete);
}
}
This runs the sql query but it tries it run it once more than required, i.e I check two check boxes, the sql runs 3times. So this casues an error as the ID is empty. I also get an undefined offset 1.
Any advice? Thanks.