Hey guys

I am confused about using checkboxes to delete entries. Yes, just for delete.

Codes for table:

PHP Code:
echo "<form method = \"post\" action=\"{$_SERVER['PHP_SELF']}\">
<table>
<tr>
<td width=\"55\" class=\"formLabelsS2\"><input type=\"submit\" name=\"delete\" value=\"Delete\" id=\"delete\"></td>
<td> Please note that entries could not be restored once they are deleted!</td>
</tr>
</table>
</form>"
;


echo 
"<table class=\"sortable\" id=\"query_quick1\" width=\"100%\" >\r\n";
echo 
"<thead>";
echo 
"\t<tr><th></th><th></th><th>Up.dated Query</th><th>Link</th><th>Promoter</th><th> # </th><th>Up?</th>
<th>Ana. Area</th><th> # </th><th>Up?</th>
<th>C. Type</th><th> # </th><th>Up?</th><th>Other C. Type</th>
<th> # </th><th>Up?</th><th>Gen. Back.</th><th> # </th><th>Up?</th>
<th>Other Gen. Back.</th><th> # </th><th>Up?</th><th>Author</th><th> # </th><th>Up?</th>
<th>Other</th><th> # </th><th>Up?</th><th>Date</th><th>Email</th>
<th>F. Name</th><th>L. Name</th></tr>\r\n"
;
echo 
"</thead>";


if(
$result->num_rows){
while (
$row $result->fetch_array()){
$RowCount ++;
$row_color = ($RowCount 2) ? $color1 $color2;
echo 
"\t<tr class=\"$row_color\" >

<form method = \"post\" action=\"
{$_SERVER['PHP_SELF']}\">
<td><input type =\"hidden\" name = \"id\" value=\"
{$row['id']}\"></td>
<td><input name=\"checkbox[]\" type=\"checkbox\" id=\"checkbox[]\" value=\"
{$rows['id']} \"></td>

<td>
{$row['query']}</td><td>{$row['link']}</td>
<td>
{$row['pro']}</td><td>{$row['pro_count']}</td>
<td>
{$row['pro_update']}</td>
<td>
{$row['ana']}</td><td>{$row['ana_count']}</td><td>{$row['ana_update']}</td>
<td>
{$row['cell']}</td><td>{$row['cell_count']}</td><td>{$row['cell_update']}</td>
<td>
{$row['cellother']}</td><td>{$row['cellother_count']}</td><td>{$row['cellother_update']}</td>
<td>
{$row['gen']}</td><td>{$row['gen_count']}</td><td>{$row['gen_update']}</td>
<td>
{$row['genother']}</td><td>{$row['genother_count']}</td><td>{$row['genother_update']}</td>
<td>
{$row['author']}</td><td>{$row['author_count']}</td><td>{$row['author_update']}</td>
<td>
{$row['other']}</td><td>{$row['other_count']}</td><td>{$row['other_update']}</td>
<td>
{$row['date']}</td><td>{$row['Email']}</td>
<td>
{$row['First_Name']}</td><td>{$row['Last_Name']}</td>
</form></tr>"
;
}
}
echo 
"</table>"

php for deleting entries:

PHP Code:
} elseif(isset($_SESSION['user_id']) AND isset($_POST['delete'])){

$connect=db_connect_2();

foreach(
$_POST['checkbox'] as $check)
{
$delete mysqli_query("DELETE FROM mailing_list WHERE id = '$check'");
}
$body "mailingList.php";

Error pops up:

Warning: Invalid argument supplied for foreach()


Of course no entries are deleted due to this warning.

Help would be greatly appreciated as always

Thanks.