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 > รบกวนช่วยดู radio button ให้หน่อยค่ะ อาการมันเป็นหยั่งงี้ คือทำเป็นแบบทดสอบเวลาที่ user ไปทำบนเว็บแล้วมัน



 

รบกวนช่วยดู radio button ให้หน่อยค่ะ อาการมันเป็นหยั่งงี้ คือทำเป็นแบบทดสอบเวลาที่ user ไปทำบนเว็บแล้วมัน

 



Topic : 030448



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



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




อาการมันเป็นหยั่งงี้ คือทำเป็นแบบทดสอบเวลาที่ user ไปทำบนเว็บแล้วมัน เช็ค radio button ได้สองตัวอ่ะค่ะ(มันควรเช็คได้ตัวเดียวใช่ม้า????)

<?
session_start();
?>
<script>
var total=0;
function check5(){
if((document.forms.choice.choice1[0].checked) ||(document.forms.choice.choice1[1].checked)||(document.forms.choice.choice1[2].checked)||(document.forms.choice.choice1[3].checked)){
total++;
}

if((document.forms.choice.choice2[0].checked) ||(document.forms.choice.choice2[1].checked)||(document.forms.choice.choice2[2].checked)||(document.forms.choice.choice2[3].checked)){
total++;
}

if((document.forms.choice.choice3[0].checked) ||(document.forms.choice.choice3[1].checked)||(document.forms.choice.choice3[2].checked)||(document.forms.choice.choice3[3].checked)){
total++;
}

if((document.forms.choice.choice4[0].checked) ||(document.forms.choice.choice4[1].checked)||(document.forms.choice.choice4[2].checked)||(document.forms.choice.choice4[3].checked)){
total++;
}

if((document.forms.choice.choice5[0].checked) ||(document.forms.choice.choice5[1].checked)||(document.forms.choice.choice5[2].checked)||(document.forms.choice.choice5[3].checked)){
total++;
}

if((document.forms.choice.choice6[0].checked) ||(document.forms.choice.choice6[1].checked)||(document.forms.choice.choice6[2].checked)||(document.forms.choice.choice6[3].checked)){
total++;
}

if((document.forms.choice.choice7[0].checked) ||(document.forms.choice.choice7[1].checked)||(document.forms.choice.choice7[2].checked)||(document.forms.choice.choice7[3].checked)){
total++;
}

if((document.forms.choice.choice8[0].checked) ||(document.forms.choice.choice8[1].checked)||(document.forms.choice.choice8[2].checked)||(document.forms.choice.choice8[3].checked)){
total++;
}

if((document.forms.choice.choice9[0].checked) ||(document.forms.choice.choice9[1].checked)||(document.forms.choice.choice9[2].checked)||(document.forms.choice.choice9[3].checked)){
total++;
}

if((document.forms.choice.choice10[0].checked) ||(document.forms.choice.choice10[1].checked)||(document.forms.choice.choice10[2].checked)||(document.forms.choice.choice10[3].checked)){
total++;
}

if(total<5){
alert("ทำไปแล้ว"+total+" ข้อ\n ทำอย่างน้อย 5 ข้อนะคะ !!");
total=0;
return false;
}
}
</script>
<table width="85%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><?
if(!session_is_registered("stu_login")) {
?>
<script>
alert("ต้องเป็นสมัครเรียนก่อน ถึงทำแบบฝึกหัดได้ค่ะ");
</script>
<?
echo "<meta http-equiv='refresh' content='0;url=index.php'>" ;
exit() ;
}
?>
<?
$les_number=$_GET[les_number];


include "config.php";
include "function.php";

$tbname = "exercise";
$sql = "select * from $tbname where les_number='$les_number' order by rand() limit 10";
$dbquery = mysql_db_query($dbname,$sql);

$num_rows = mysql_num_rows($dbquery);
//print $num_rows;
?>
<form action="exercise_check.php" method="post" enctype="multipart/form-data" name="choice" onSubmit="return check5();">
<table width="100%" height="48" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><h2 align="left">คุณกำลังทำแบบฝึกหัดบทที่&nbsp;&nbsp;<font color="#FF0000"><? print $les_number; ?></font> &nbsp;ค่ะ</h2></td>
</tr>
<?
for($i=0;$i<$num_rows;$i++){
$result = mysql_fetch_array($dbquery);
$test_id = $result[ex_id];
$les_number = $result[les_number];
$question = $result[question];
$choice1 = $result[choice1];
$choice2 = $result[choice2];
$choice3 = $result[choice3];
$choice4 = $result[choice4];
$correct = $result[correct];
?>
<tr>
<td colspan="6"><table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td colspan="3"><font size="2" face="MS Sans Serif"><b>ข้อที่&nbsp;&nbsp;<font color="#FF0000"><? print $i+1;?>&nbsp;&nbsp;&nbsp;&nbsp;</font><? print $question;?></b></font></td>
</tr>
<tr>
<td width="64"><div align="right"> <font size="2" face="MS Sans Serif">
<label>
<input name="choice <? print $i+1;?>" type="radio" value="1"/>
</label>
</font></div></td>
<td width="817"><font size="2" face="MS Sans Serif"><? print $choice1;?></font></td>
</tr>
<tr>
<td><div align="right"> <font size="2" face="MS Sans Serif">
<label>
<input name="choice<? print $i+1;?>" type="radio" value="2"/>
</label>
</font></div></td>

<td><font size="2" face="MS Sans Serif"><? print $choice2;?></font></td>
</tr>
<tr>
<td><div align="right"> <font size="2" face="MS Sans Serif">
<label>
<input name="choice<? print $i+1;?>" type="radio" value="3"/>
</label>
</font></div></td>

<td><font size="2" face="MS Sans Serif"><? print $choice3;?></font></td>
</tr>
<tr>
<td><div align="right"> <font size="2" face="MS Sans Serif">
<label>
<input name="choice<? print $i+1;?>" type="radio" value="4"/>
</label>
</font></div></td>

<td><font size="2" face="MS Sans Serif"><? print $choice4;?></font></td>
</tr>
<tr>
<td><font size="2" face="MS Sans Serif">
<input name="test_id<? print $i+1;?>" type="hidden" id="test_id" value="<? print $test_id;?>" />
<input name="correct<? print $i+1;?>" type="hidden" id="correct<?print $i+1;?>" value="<? print $correct;?>" />
</font></td>
<td><font size="2" face="MS Sans Serif">&nbsp;</font></td>
<td>&nbsp;</td>
</tr>
</table></td>
</tr>
<?
}
?>
<tr>
<td colspan="6" align="left"><div align="center">
<input name="type" type="hidden" id="type" value="แบบฝึกหัดท้ายบท" />
<input name="les_number" type="hidden" id="les_number" value="<? print $les_number;?>" />
<input type="submit" name="Submit" value="ตรวจแบบฝึกหัด" />
<input type="reset" name="Submit2" value="ทำใหม่" />
</div></td>
</tr>
<tr>
<td colspan="6">&nbsp;</td>
</tr>
</table>
</form></td>
</tr>
</table>



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2009-08-18 11:35:41 By : ying-oohho View : 1025 Reply : 3
 

 

No. 1



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

สมาชิกที่ใส่เสื้อไทยครีเอท

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


Code (PHP)
<?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>
<script language="javascript">
/*develop by Bigquery.com*/

function checkBoxSelectOne(cb,gp,grp){
   eval("var gn=gp." + grp);
   eval("var len= gn.length");
   eval("var lx= gp.hid" +grp);
   if(gn[cb].checked == true){
      for (j=0; j < len ; j++ ){
         if(gn[j].checked==true){
            gn[j].checked = false
         } 
         if(j == cb){
            gn[j].checked=true
            lx.value=gn[j].value
         } 
      }
   }else{
      lx.value=""
   }
}
</script>
</head>

<body>
<form name="selectOne" action="checkbox_select_one.html">
Your web site is dynamic or static?<br />
<input type="checkbox" name="site" value="dynamic" onClick="checkBoxSelectOne(0, this.form, this.name)" /> Dynamic
<input type="checkbox" name="site" value="static" onClick="checkBoxSelectOne(1, this.form, this.name)" /> Static
<input type="hidden" name="hidsite" /><br />
------------------------------------------------<br />
Which language to learn for make website?<br />
<input type="checkbox" name="lang" value="ASP" onClick="checkBoxSelectOne(0, this.form, this.name)" /> ASP
<input type="checkbox" name="lang" value="PHP" onClick="checkBoxSelectOne(1, this.form, this.name)" /> PHP
<input type="checkbox" name="lang" value="C#.net" onClick="checkBoxSelectOne(2, this.form, this.name)" /> C#.net
<input type="checkbox" name="lang" value="JSP" onClick="checkBoxSelectOne(3, this.form, this.name)" /> JSP
<input type="hidden" name="hidlang" /><br />
------------------------------------------------<br />
<input type="submit" name="submitted" value="Submit" />
</form> 
</body>
</html>

?>

ตัวอย่าง






Date : 2009-08-18 11:51:09 By : panyapol
 


 

No. 2



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

สมาชิกที่ใส่เสื้อไทยครีเอท

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


Quote:
<input name="choice <? print $i+1;?>" type="radio" value="1"/>


ขยับให้มันชิดกันครับ
Code (PHP)
<?php
<input name="choice<? print $i+1;?>" type="radio" value="1"/>
?>

Date : 2009-08-18 12:05:29 By : lozomac
 

 

No. 3

Guest


ได้แล้วค่ะ ขอบคุณมากมาย
Date : 2009-08-18 13:04:14 By : ying-oohho
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : รบกวนช่วยดู radio button ให้หน่อยค่ะ อาการมันเป็นหยั่งงี้ คือทำเป็นแบบทดสอบเวลาที่ user ไปทำบนเว็บแล้วมัน
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 อัตราราคา คลิกที่นี่