<FORM METHOD=POST ACTION="prerandom_check.php">
<?
$number=1;
include "connect.php";
$sql="SELECT * FROM test ORDER BY RAND() LIMIT 5";
$result=mysql_db_query("$dbname",$sql);
while ($r=mysql_fetch_array($result)) {
$id=$r[test_id];
$question=$r[question];
$choice1=$r[choice1];
$choice2=$r[choice2];
$choice3=$r[choice3];
$choice4=$r[choice4];
อันนี้ฟังก์ชั่นการตรวจนับคะแนนคับ(prerandom_check.php)
<?
$correct=0;
$total=count($total_question);
include "connect.php";
$sql="select test_id,answer from test order by test_id";
$result=mysql_db_query("$dbname",$sql);
while ($r=mysql_fetch_array($result)) { //
$id=$r[test_id];
$answer=$r[answer]; //ดึงรหัสเเละคำตอบที่ถูกของแบทดสอบ