Selecting values from the database and make the checkbox checked if it does exist
<pre><code>//query to check if part id number exists in table ATTEND where service id = ...
$result2 = mysql_query("SELECT * FROM attend WHERE SIDno='$SIDno' and ServiceID='$id");
//if exists $ok = true;
  if (mysql_num_rows($result2)&gt;0) {
     $ok == true;
  }
  echo "&lt;tr bgcolor=$bgcolor&gt;";
  echo "&lt;td&gt;&lt;a name=$row1[0] id=$row1[0]&gt;$row1[0]&lt;/td&gt;";
  echo "&lt;td&gt;" . $row1[1] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row1[5] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row1[2] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row1[3] . "&lt;/td&gt;";
  echo "&lt;td&gt;&lt;input type='checkbox' name='checkbox[]' value=" . $row1[0];
  if ($ok == true) {
    echo 'disabled="disabled" checked="checked"';
  }
  echo "&gt;&lt;/td&gt;";
  echo "&lt;input type='hidden' name='ServiceID' value=" . $id . "&gt;";
  echo "&lt;input type='hidden' name='Year' value=" . $Year . "&gt;";
  echo "&lt;input type='hidden' name='Stype' value='Recollection'&gt;";

  echo "&lt;/tr&gt;";
  } 
}
echo "&lt;tr&gt;
&lt;td colspan='5' align='right' bgcolor='#FFFFFF'&gt;&lt;input name='SUBMIT1' type='submit' id='SUBMIT'value='SUBMIT'&gt;&lt;/td&gt;
&lt;/tr&gt;";
</code></pre>

<p>How can implement that on the next load if the value of the checkbox is already available in the database it will now be checked. but if it is not yet existing i can check it and save it to the database.</p>
