title: Deleting records selected by Checkbox
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5752105/delete-values-selected-using-checkbox">Delete values selected using checkbox</a>  </p>
  </blockquote>
  
  
  
  <p>I want to delete records that has been selected using Checkbox</p>
  
  <p>Checkbox code</p>
  
  <pre><code>&lt;input name="checkbox[]" type="checkbox" value="&lt;?=$row[s_id]?&gt;" id="checkbox[]"&gt;
  </code></pre>
  
  <p>ON delete button</p>
  
  <pre><code>if($_POST['delete'])
  {
  $cnt=array();
  //$cnt=array_count_values($_POST[checkbox]);
  $cnt=count($_POST['checkbox']);
  for($i=0; $i &lt; $cnt; $i++)
  {
          $del_id=$checkbox[$i];
          //$sql = "DELETE FROM t_s_list WHERE `s_id`='".mysql_real_escape_string($del_id)."'";
          $sql = "DELETE * FROM t_s_list WHERE `s_id`= '$del_id'";
          $result = mysql_query($sql);
          mysql_error();
          $NEW="Selected records Deleted";
  }
  $NEW="Selected records not Deleted";
  }
  </code></pre>