Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > พอดีทำข้อสอบหลายตัวเลือกครับพอดีรับฟอร์มมาเป็น check box แล้วให้ตรวจสอบแต่ติดปัญหาอย่างมากคือตรวจข้อสอบไม่ได้ครับไม่ทราบว่ามีปัญหาไรไหมครับเลยเอามาให้ดูกันหน่อยเผื่อเจอปัยหา



 

พอดีทำข้อสอบหลายตัวเลือกครับพอดีรับฟอร์มมาเป็น check box แล้วให้ตรวจสอบแต่ติดปัญหาอย่างมากคือตรวจข้อสอบไม่ได้ครับไม่ทราบว่ามีปัญหาไรไหมครับเลยเอามาให้ดูกันหน่อยเผื่อเจอปัยหา

 



Topic : 084182



โพสกระทู้ ( 68 )
บทความ ( 0 )



สถานะออฟไลน์




พอดีทำข้อสอบหลายตัวเลือกครับพอดีรับฟอร์มมาเป็น check box แล้วให้ตรวจสอบแต่ติดปัญหาอย่างมากคือตรวจข้อสอบไม่ได้ครับไม่ทราบว่ามีปัญหาไรไหมครับเลยเอามาให้ดูกันหน่อยเผื่อเจอปัยหา
ฟอร์มครับ

Code (PHP)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>ข้อสอบออนไลน์</title>
</head>

<body>
<b>ข้อสอบให้เลือกตอบข้อที่ถูกต้อง<b/>
<form method="post" action="random_check1.php">
<?
$number=1;
require_once('../config/config.php');
$sql="select * from Multiple_question_choice order by rand() limit 0,5";
$result=mysql_db_query("$dbname",$sql);
while ($r=mysql_fetch_array($result)){
$id=$r[Multiple_Question_Id];
$question=$r[Question_Details];
$choice1=$r[Choice_1];
$choice2=$r[Choice_2];
$choice3=$r[Choice_3];
$choice4=$r[Choice_4];
$choice5=$r[Choice_5];
$choice6=$r[Choice_6];
echo"<b>$number. $question</b><br>
<input type='checkbox' name='[select_$id][]' value='$choice1'>
$choice1<br>
<input type='checkbox' name='[select_$id][]' value='$choice2'>
$choice2<br>
<input type='checkbox' name='[select_$id][]' value='$choice3'>
$choice3<br>
<input type='checkbox' name='[select_$id][]' value='$choice4'>
$choice4<br>
<input type='checkbox' name='[select_$id][]' value='$choice5'>
$choice5<br>
<input type='checkbox' name='[select_$id][]' value='$choice6'>
$choice6<br>
<input type='hidden' name='total_question[]' value='$id'<br>
<hr>";
$number++;
}

?>
<input type="submit" value="submit"><input type="reset" value="reset">
</form>
</body>
</html>
</body>
</html>

ตัวตรวจคะแนน
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?
$correct=0;
$total=count($total_question);
require_once('../config/config.php');
$sql="select Multiple_Question_Id, Mul_Choice_Correct_A,  Mul_Choice_Correct_B from  multiple_question_choice order by Multiple_Question_Id" ;
$result=mysql_db_query($dbname,$sql);
while ($r=mysql_fetch_array($result)){
$id=$r[Multiple_Question_Id];
$answer1=$r[Mul_Choice_Correct_A];
$answer2=$r[Mul_Choice_Correct_B];
if (in_array($id, $total_question)){
$select="select_".$id;
if (${$select}==$answer1) {
$correct++;
}
}else if(${$select}==$answer2) {
$correct++;
}
echo"<h2>ถูกต้องทั้งหมด $correct ข้อ <br>
ข้อสอบทั้งหมด $total ข้อ </h2>";
}
?>
</body>
</html>




Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-09-18 12:13:50 By : dannan882 View : 1084 Reply : 1
 

 

No. 1



โพสกระทู้ ( 4,169 )
บทความ ( 7 )

Hall of Fame 2012

สถานะออฟไลน์


ใส่ Tag Code ด้วยครับCode (PHP)
พอดีทำข้อสอบหลายตัวเลือกครับพอดีรับฟอร์มมาเป็น check box แล้วให้ตรวจสอบแต่ติดปัญหาอย่างมากคือตรวจข้อสอบไม่ได้ครับไม่ทราบว่ามีปัญหาไรไหมครับเลยเอามาให้ดูกันหน่อยเผื่อเจอปัยหา
ฟอร์มครับ
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>ข้อสอบออนไลน์</title>
</head>

<body>
<b>ข้อสอบให้เลือกตอบข้อที่ถูกต้อง<b/>
<form method="post" action="random_check1.php">
<?
$number=1;
require_once('../config/config.php');
$sql="select * from Multiple_question_choice order by rand() limit 0,5";
$result=mysql_db_query("$dbname",$sql);
while ($r=mysql_fetch_array($result)){
$id=$r[Multiple_Question_Id];
$question=$r[Question_Details];
$choice1=$r[Choice_1];
$choice2=$r[Choice_2];
$choice3=$r[Choice_3];
$choice4=$r[Choice_4];
$choice5=$r[Choice_5];
$choice6=$r[Choice_6];
echo"<b>$number. $question</b><br>
<input type='checkbox' name='[select_$id][]' value='$choice1'>
$choice1<br>
<input type='checkbox' name='[select_$id][]' value='$choice2'>
$choice2<br>
<input type='checkbox' name='[select_$id][]' value='$choice3'>
$choice3<br>
<input type='checkbox' name='[select_$id][]' value='$choice4'>
$choice4<br>
<input type='checkbox' name='[select_$id][]' value='$choice5'>
$choice5<br>
<input type='checkbox' name='[select_$id][]' value='$choice6'>
$choice6<br>
<input type='hidden' name='total_question[]' value='$id'<br>
<hr>";
$number++;
}

?>
<input type="submit" value="submit"><input type="reset" value="reset">
</form>
</body>
</html>
</body>
</html>





Code (PHP)
ตัวตรวจคะแนน
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?
$correct=0;
$total=count($total_question);
require_once('../config/config.php');
$sql="select Multiple_Question_Id, Mul_Choice_Correct_A, Mul_Choice_Correct_B from multiple_question_choice order by Multiple_Question_Id" ;
$result=mysql_db_query($dbname,$sql);
while ($r=mysql_fetch_array($result)){
$id=$r[Multiple_Question_Id];
$answer1=$r[Mul_Choice_Correct_A];
$answer2=$r[Mul_Choice_Correct_B];
if (in_array($id, $total_question)){
$select="select_".$id;
if (${$select}==$answer1) {
$correct++;
}
}else if(${$select}==$answer2) {
$correct++;
}
echo"<h2>ถูกต้องทั้งหมด $correct ข้อ <br>
ข้อสอบทั้งหมด $total ข้อ </h2>";
}
?>
</body>
</html>









ประวัติการแก้ไข
2012-09-18 13:00:59
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-09-18 12:58:58 By : Ex-[S]i[L]e[N]t
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : พอดีทำข้อสอบหลายตัวเลือกครับพอดีรับฟอร์มมาเป็น check box แล้วให้ตรวจสอบแต่ติดปัญหาอย่างมากคือตรวจข้อสอบไม่ได้ครับไม่ทราบว่ามีปัญหาไรไหมครับเลยเอามาให้ดูกันหน่อยเผื่อเจอปัยหา
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่