Hi
Im using the following code to create checkboxes in a form. What I need, is the boxes the user checked, to remain checked after the form has been submitted. The reason for this is so that the user will not have to re-check the boxes if they would like to submit the form again. How can I do this using php code ?
if ($db_found) {
$sql="select cname, cid from course";
//query the database
$rs=mysql_query($sql) or die($sql.">>".mysql_error());
//count how many records found
$num=mysql_num_rows($rs);
if($num>0){ //check if
<FORM NAME ="form1" METHOD ="POST" ACTION ="student_reg.php">
//create array loop
while($row=mysql_fetch_array($rs)){
// extract row and echo the array
extract($row);
echo "$cname"."<Input type = 'Checkbox' Name ='chk1[]' value ='$cid'>";
}
<INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Register">
</FORM>
}
}