title: how to get the value of multiple checkbox in php
body: <p>I have use the following code to select multiple value for selected checkbox  to delete it from  database table but when I am print_r its only shows keys for it not showing value for id. </p>
  
  <p>I have use this code to get value in array:-</p>
  
  <pre><code>&lt;?php
  echo "Hiiiiiiiiii";
  include("conn.php");
  $sql="select * from test ";
  
  $res=mysql_query($sql) or die(mysql_error());
  ?&gt;
  
  &lt;form name="form1" method="POST" action=""&gt;
      &lt;table width="578" border="1" align="center" id="menu"&gt;
      &lt;tr&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;id&lt;/th&gt;
      &lt;th&gt;Name&lt;/th&gt;
      &lt;th&gt;email&lt;/th&gt;
      &lt;th&gt;phno&lt;/th&gt;
   &lt;/tr&gt;
  
  &lt;?php
   while($row=mysql_fetch_array($res))
   {
  ?&gt;
  
   &lt;tr&gt;
  
      &lt;td&gt;&lt;input name="checkbox[]" type="checkbox" id="checkbox[]" value="&lt;? echo $rows['id']; ?&gt;"&gt;&lt;/td&gt;
      &lt;td&gt;&lt;?php echo $row['id'];?&gt;&lt;/td&gt;
  
      &lt;td&gt;&lt;?php echo $row['name'];?&gt;&lt;/td&gt;
      &lt;td&gt;&lt;?php echo $row['emailid'];?&gt;&lt;/td&gt;
  
      &lt;td&gt;&lt;?php echo $row['phno'];?&gt;&lt;/td&gt;
      &lt;?php
      echo"&lt;td&gt;&lt;a href='update.php?id=".$row['id']."'&gt;Update&lt;/a&gt;&lt;/td&gt;";
      ?&gt;
   &lt;?php
    }
   ?&gt;  
   &lt;tr&gt;&lt;td&gt;&lt;input type="submit" name="delete" value="Delete" id="delete"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tr&gt;&lt;/table&gt;
  
   &lt;?php
  // Check if delete button active, start this
  $count = mysql_num_rows($res);
  echo "$count";
  
  if(isset($_POST['delete']))
  {
      if(count($_POST['checkbox']) !=0)
      {
          $array = array("checkbox" =&gt; $_POST['checkbox']);
          print_r($array);
          $ids = implode(',', $array);
          echo "$ids";
          $result = mysql_query("DELETE FROM test WHERE id IN ($ids)") or die(mysql_error());
      }
  }
  // if successful redirect to delete_multiple.php 
  if($result)
      {
       echo "&lt;meta http-equiv=\"refresh\" content=\"0;URL=teach_delinquent.php\"&gt;";
       echo "SUCCESS";
      }
  
   ?&gt;
  </code></pre>