Maybe try checking the value with isset first?
if (isset($_POST['delete'][$i])) {
$delete_id = $_POST['delete'][$i];
// do delete here...
}
OR you could just leave the delete query OUTSIDE your loop which is where I had intended it to go. If it's inside your loop, you should probably change your query...it's deleting all those records over and over again each loop iteration so you have a lot of wasted effort probably. If you are just dying to have it in the loop, use this instead:
$sql = "DELETE FROM bb_groups WHERE group_id=" . $delete_id;
Also, as a matter of security, you should check all of your $delete_id values to make sure they don't permit sql injection. You either need to use [man]mysql_real_escape_string[/man] on every single value that comes from user input, or you need to make sure that every delete id supplied is just a simple number. A mean-spirited miscreant might supply a delete_id that already has a comma-separated list in it, effectively deleting ALL of your records. imagine that $_POST['delete'][1] had this in it:
1,2,3,4,5,6,7,8,9,10,11,12,13,14
And then you go and stick it right in your code and get this query:
DELETE FROM bb_groups WHERE group_id IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14)
You should check each delete id to make sure it's a number with something like this:
if (!preg_match('/^\d+$/', $delete_id)) {
die($delete_id . ' is not a valid id');
}