|
![](/images/resource/spacer.gif) |
|
การเลือก radio button จากการทำแบบสอบถาม โดย select คำถามจากฐานข้อมูลมาแสดง |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
เลือกได้อันเดียวเพราะ radio button มันมี name เดียวกันครับ name="nall"
ต้องลูปให้มันแล้วเปลี่ยนชื่อ name ไปด้วยครับ
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2016-02-04 17:29:43 |
By :
electric19 |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ไหนๆมันก็ลวลูป กำหนดค่า $i = 1
ก่อนออกลูปก็ ++$i;
เข้าไป
เอา $i ไปต่อ nall มันจะได้ nall1 nall2 nall3 หรือเปล่านะไม่แน่ใจ
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2016-02-04 20:38:05 |
By :
apisitp |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
แนะนำให้ใช้ id ของตารางคำถามเป็นตัวกำหนด หัวข้อ เพื่อใช้อ้างอิง เวลาตอบ
Code (PHP)
<?php
$qtion = "SELECT id, question FROM question where evaluation_id ='1' && question_type = 'q'";
$Qqtion = mysql_query($qtion);
while ($Rqtion = mysql_fetch_assoc($Qqtion)){
$qid=$Rqtion['id'];
?>
<tr>
<td bgcolor="#FFCC99"><?php echo $Rqtion['question'];?>
<input type=hidden name="question_id[]" value="<?php echo $qid;?>"></td>
<td><input name="nall<?php echo $qid;?>" type="radio" value="1"></td>
<td><input name="nall<?php echo $qid;?>" type="radio" value="2"></td>
<td><input name="nall<?php echo $qid;?>" type="radio" value="3"></td>
<td><input name="nall<?php echo $qid;?>" type="radio" value="4"></td>
<td><input name="nall<?php echo $qid;?>" type="radio" value="5"></td>
</tr>
<?php
}
?>
โปรแกรมตัวรับ
Code (PHP)
foreach( $_POST['question_id'] as $qid){
echo $qid,' === ', $_POST['nall'.$qid],'<br>';
}
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2016-02-05 08:00:53 |
By :
Chaidhanan |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ขอบคุณ ทุกคำแนะนำนะคะ![](/images/bbcode/grin.gif?v=1001) ![](/images/bbcode/grin.gif?v=1001) ![](/images/bbcode/grin.gif?v=1001)
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2016-02-09 14:36:27 |
By :
หมี |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 05
|