<? $sqlConnect = mysql_connect("localhost","root","12345") or die("Error Connect to Database");
$sqlDB = mysql_select_db("dss");
$updaterule=mysql_query("select * from rules where rule_id =$id");
$result = mysql_fetch_array($updaterule);
$rule_id=$result[rule_id];
$date=$result[date];
$updateresult=mysql_query("select * from result where rule_id =$id");
$query_question=mysql_query("SELECT * FROM questionnaire WHERE major_id=$major_id");
while($row=mysql_fetch_array($query_question)){$q_id=$row['question_id'];
?><input name="add[]" type="checkbox" id="add" value="<?=$row["question_id"] ;?>"
<? $query_detail=mysql_query("SELECT question_id FROM rule_detail WHERE rule_id =$id") or die ("Error select rule detail");
while($row1=mysql_fetch_array($query_detail)){ $d_id=$row1['question_id'];
if ($row["question_id"]==$d_id) {?> checked<? } }?>> <?= $row["question"]; ?><br>
<? }?>