In your while loop, you have "<form action='' method='post' ...etc...>". That means that the HTML code for the beginning of the form is being sent with each iteration of the loop, so you have to move it to outside of the loop. Now, instead of the checkboxes being named what they already are, set them to do this:
echo "<input type='checkbox' name='delete[]' value='$id' />";
Allright, you're almost done. In the part of the script that actually processes and deletes things, you need to do this:
foreach ($_POST['delete'] as $key => $id)
{
$sql = "DELETE FROM table WHERE id='$id'";
safe_query($sql) or die("Error!");
}
And it will iterate through all the checked boxes and delete them from the DB. It's confusing at first - it took me a while to get the hang of checkboxes in PHP too. But once you understand it, it's really simple 😃