โดย ์Narenat » 25/02/2018 2:56 pm
<?php
/*$answer1 = $_POST['1'];// รับค่าคำตอบ้อที่ 1
$answer2 = $_POST['2'];// รับค่าคำตอบ้อที่ 1
*/
$score=0;//เก็บคะแนนที่ทำได้
foreach($_POST as $choice=>$answer){
if ($chioce!='btnSend'){
$sql="Select id From tb_choice_reading Where id = {$choice} and answer = {$answer}";
$rs = mysql_query($sql);
if(mysql_num_rows($rs)==1){//แสดงว่าตอบถูก echo mysqlerror()
$score++;// เพิ่มคะแนน
}
echo 'ข้อ:',$choice, 'ตอบ',$answer,'<br/>';
}
}
$pass='ไม่ผ่าน';
if($score>=5){// ตรวจสอบคะแนนที่ได้ผ่านหรือไม่
$pass='ผ่าน';
}
echo 'คะแนนที่ทำได้',$score,'คะแนน';
echo'<br/>ผลการทดสอบ:',$pass;
?>
<?php
/*$answer1 = $_POST['1'];// รับค่าคำตอบ้อที่ 1
$answer2 = $_POST['2'];// รับค่าคำตอบ้อที่ 1
*/
$score=0;//เก็บคะแนนที่ทำได้
foreach($_POST as $choice=>$answer){
if ($chioce!='btnSend'){
$sql="Select id From tb_choice_reading Where id = {$choice} and answer = {$answer}";
$rs = mysql_query($sql);
if(mysql_num_rows($rs)==1){//แสดงว่าตอบถูก echo mysqlerror()
$score++;// เพิ่มคะแนน
}
echo 'ข้อ:',$choice, 'ตอบ',$answer,'<br/>';
}
}
$pass='ไม่ผ่าน';
if($score>=5){// ตรวจสอบคะแนนที่ได้ผ่านหรือไม่
$pass='ผ่าน';
}
echo 'คะแนนที่ทำได้',$score,'คะแนน';
echo'<br/>ผลการทดสอบ:',$pass;
?>