警告为foreach()提供的参数无效

I am getting this error message and I don't have any clue what to do about it.

Warning: Invalid argument supplied for foreach() in /home/a9083956/public_html/zundappgroesbeek/beheer/testretrievesql.html on line 31

This is the code I am working with. The warning is from the 31st line, a foreach() line. Ive changed the = to => to make the checkbox work, but the delete code won't work still.

<html>
  <head>
    <title>Retrieve and delete data  from database </title>
  </head>
<body>

<?php
    // Connect to database server
    mysql_connect("mysql7.000webhost.com", "a9083956_test", "sesam") or die (mysql_error ());

    // Select database
    mysql_select_db("a9083956_test") or die(mysql_error());

    // SQL query
    $strSQL = "SELECT * FROM forum_question";

    // Execute the query (the recordset $rs contains the result)
    $rs = mysql_query($strSQL);

    // Loop the recordset $rs
    // Each row will be made into an array ($row) using mysql_fetch_array
    while($row = mysql_fetch_array($rs)) {

      // Write the value of the column FirstName (which is now in the array $row)
      echo '<input name="delete['.$row['id'].']" type="checkbox">';
      echo $row['topic']. " " .$row['name']. " " .$row['datetime'] . "<br />";

      $delete = $_POST['delete'];

      foreach($delete as $id => $value)
      {
          $id = mysql_real_escape_string($id);
          mysql_query("DELETE FROM table_name WHERE id => $id");
      }
    }

    // Close the database connection
    mysql_close();
    ?>
    </body>
</html>

Try this:

while($row = mysql_fetch_array($rs)) {

    // Write the value of the column FirstName (which is now in the array $row)
    echo '<input name="delete[]" type="checkbox">';
    echo $row['topic']. " " .$row['name']. " " .$row['datetime'] . "<br />";

}
$delete = mysql_real_escape_string($_POST['delete']); 
for($i=0; $i < count($delete); $i++){
    mysql_query("DELETE FROM table_name WHERE id = $delete[$i] ");
}

If you don't check any boxes, then $_POST['delete'] will not be set. Use if (isset($_POST['delete'])) before your foreach.

Also there's a bug in your SQL, you want WHERE id = "$id", otherwise it will delete more rows than you intended...