title: Delete multiple data from db with checkbox
body: <p>How to delete multiple data from table with checkbox?
  I have this code:</p>
  
  <pre><code>&lt;form id="prefForm" action="coments-del.php" method="post"&gt;
  
  &lt;?
  
  $result = mysql_query("SELECT * FROM comments");      
  $myrow = mysql_fetch_array($result);
  
  do
  {
      $res = mysql_query("SELECT title FROM data WHERE id=$myrow[post]");
      $row = mysql_fetch_array($res);
      printf ("
           &lt;tr&gt;
             &lt;td&gt;
                  &lt;input type='checkbox' name='id' value='%s'  /&gt;
                  &lt;/td&gt;        
                  &lt;td&gt;%s&lt;/td&gt;
             &lt;td&gt;%s&lt;/td&gt;
                  &lt;td&gt;%s&lt;/td&gt;
           ",$myrow["id"],$myrow["id"],$myrow["author"],$myrow["text"]);
  }
  while ($myrow = mysql_fetch_array($result));
  ?&gt;
  
  &lt;input name="submit-button" type="submit" value="Delete" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Here is the coments-del.php where you get brought after submiting form in script above.</p>
  
  <p>In the head is:</p>
  
  <pre><code>if (isset($_POST['id'])) { $id = $_POST['id']; }
  </code></pre>
  
  <p>At the body is the code that proccess the deleting.</p>
  
  <pre><code>&lt;?php 
  if (isset($id)) {
      $result = mysql_query ("DELETE FROM comments WHERE id='$id'");
  
      if ($result == 'true') {echo "Comment Deleted!";}
      else {echo "Error: Nothing was deleted!";}
  
  } else {
      echo "Unknown Error! Contact Administrator.";
  }
  
  ?&gt;
  </code></pre>