title: Want to update multiple records using checkboxes and save button
body: <p>I am searching some records using two text boxes and then updating the selected records in database. i am able to see the value row id of the selected checkbox but when i want to get the value for updation in database it gives 0, i.e showing no record in array</p>
  
  <p>Here is my code</p>
  
  <pre><code>if($_POST["search"])
  {
      $nitnumber = $_POST["nitnumber"];
      $workno = $_POST["workno"];
      $query = "select * from print where nit = $nitnumber and work = $work";
      $result = mysql_query($query) or die ("&lt;font color =red&gt;NIT Number and/or Work Number is Missing&lt;/font&gt;");
      $count = mysql_num_rows($result);
  if($count == 0)
      echo "&lt;font color=red&gt;Record not found&lt;/font&gt;";
                  else
                  {
                  while($record = mysql_fetch_assoc($result))
                  {
                  ?&gt;  
    &lt;tr class="odd"&gt;
    &lt;td&gt;&lt;div align="center"&gt;&lt;?php echo $record['a']; ?&gt;&lt;/div&gt;&lt;/td&gt;
    &lt;td&gt;&lt;div align="center"&gt;&lt;?php echo $record['b']; ?&gt;&lt;/div&gt;&lt;/td&gt;
    &lt;td&gt;&lt;div align="left"&gt;&lt;?php echo $record['c']; ?&gt;&lt;/div&gt;&lt;/td&gt;
    &lt;td&gt; &lt;div align="left"&gt;
  &lt;?php 
     enter code hereecho $record["d"];    
             ?&gt;                   
            &lt;/td&gt;
              &lt;td&gt; 
                  &lt;input name="checkbox[]" id="checkbox[]" type="checkbox" value="&lt;?php echo $record[$id];?&gt;"&gt;                        
                  &lt;?php echo $record["id"];?&gt;
              &lt;/td&gt;
              &lt;?php } } }?&gt;
              &lt;tr&gt;
                  &lt;td colspan="5" align="right"&gt; &lt;input type="submit" value="Save" name="save"&gt; &lt;/td&gt;
              &lt;/tr&gt;
  
  &lt;?php    
   if ($_POST['save'])
  {
         $num_chkboxes=count($_POST['checkbox']);
         for($i=0; $i&lt;$num_chkboxes; $i++){
         $complete = intval($checkbox[$i]);
         echo $complete;
         var_dump($complete);
         echo $updateSQL = "UPDATE toDo SET complete=1, WHERE toDoId=$complete";
         //$Result1 = mysql_query($updateSQL, $FamilyOrganizer) or die(mysql_error());
  }
  }
  ?&gt;
  </code></pre>