|
|
|
ทำแบบสอบถามแบบมีหลายกลุ่มคำถามดึงจากฐานข้อมูล และเป็น Radio |
|
|
|
|
|
|
|
จะต้องตั้งชื่อ id เป็น แถว และก็ คอลัมบ์ครับ เช่น
Code (ASP)
ข้อ 1
<input name="row1_1" type="radio" value="1" />
<input name="row1_2" type="radio" value="2" />
<input name="row1_3" type="radio" value="3" />
<input name="row1_4" type="radio" value="4" />
ข้อ 2
<input name="row2_1" type="radio" value="1" />
<input name="row2_2" type="radio" value="2" />
<input name="row2_3" type="radio" value="3" />
<input name="row2_4" type="radio" value="4" />
|
|
|
|
|
Date :
2011-05-19 18:10:24 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
หรือเปลี่ยนวิธีเขียนดีครับพี่วิน
แล้วเวลาส่งค่า มันจะส่งไปเป็นค่าเฉพาะ value แล้วถ้าเราจะเอา ID ของแต่ละข้อไปด้วยครับ
|
|
|
|
|
Date :
2011-05-19 18:21:52 |
By :
b |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (ASP)
<table width="852" border="0">
<form action="pms_save.asp" method="post" name="form1" id="form1">
<tr bgcolor="#316AC5">
<th colspan="7" align="left" bgcolor="#FFFFFF" class="txtContentBold" scope="col"><table width="794" border="0" cellpadding="0" cellspacing="0" bgcolor="#F3F3F3">
<tr>
<td width="4%" height="20" bgcolor="#FFFFFF" class="txtcontentM4"><div align="right"></div></td>
<td width="56%" bgcolor="#FFFFFF" class="txtContent11"> </td>
<td width="8%" bgcolor="#FFFFFF" class="txtContent11"><div align="center">5</div></td>
<td width="8%" bgcolor="#FFFFFF" class="txtContent11"><div align="center">4</div></td>
<td width="8%" bgcolor="#FFFFFF" class="txtContent11"><div align="center">3</div></td>
<td width="8%" bgcolor="#FFFFFF" class="txtContent11"><div align="center">2</div></td>
<td width="8%" bgcolor="#FFFFFF" class="txtContent11"><div align="center">1</div></td>
</tr>
</table></th>
</tr>
<tr bgcolor="#316AC5">
<th colspan="7" align="left" bgcolor="#669900" class="txtContentBold" scope="col"> </th>
</tr>
<tr bgcolor="#316AC5">
<th colspan="7" align="left" bgcolor="#FFFFFF" class="txtcontentM5" scope="row"> <!--#include file="conn_db.asp"-->
<%adminid=session("username")%>
<%
set rs1 = server.CreateObject("adodb.recordset")
sql1 ="select *from Group_answer "
rs1.open sql1,conn,1,3
Group_id=rs1("Group_id") %>
<br />
<table width="843" height="93" border="0" cellpadding="0" cellspacing="0" class="txtContentBold10">
<tr bgcolor="#FF0000">
<td height="17" colspan="2" bgcolor="#CCCCCC" class="txtcontentW"> </td>
<td bgcolor="#CCCCCC" class="txtcontentW"><div align="center">5</div></td>
<td bgcolor="#CCCCCC" class="txtcontentW"><div align="center">4</div></td>
<td bgcolor="#CCCCCC" class="txtcontentW"><div align="center">3</div></td>
<td bgcolor="#CCCCCC" class="txtcontentW"><div align="center">2</div></td>
<td bgcolor="#CCCCCC" class="txtcontentW"><div align="center">1</div></td>
</tr>
<tr bgcolor="#FF0000">
<%do while not rs1.eof %> <td height="29" colspan="7" bgcolor="#CCCCCC" class="txtcontentW"><img src="../../images/expanded.gif" width="12" height="12" /><span class="txtContentBoldWhite"> <%=rs1("Group_name")%></span>
<%Group_id=rs1("Group_id")%>
<%'/////////////////////////////////////////////////////////////////////////////////////////////////%>
<span class="style4"> </span></td>
</tr>
<%
set rs2 = server.CreateObject("adodb.recordset")
sql2 ="select *from Answer where Group_id='"&Group_id&"' order by Choice_id desc"
rs2.open sql2,conn,1,3
%>
<%do while not rs2.eof %>
<tr>
<td width="2%" height="20" class="txtContent11"> </td>
<td width="58%" class="txtContent11"><%=rs2("Choice_name")%>
<%Choice_id=rs2("Choice_id")%></td>
<td width="8%" class="txtContent11"><div align="center">
<%=rs2("Choice_id")%> <input name="<%=Choice_id%>" type="radio" value="5" />
</div></td>
<td width="8%" class="txtContent11">
<div align="center">
<input name="<%=Choice_id%>" type="radio" value="4" />
</div></td>
<td width="8%" class="txtContent11">
<div align="center">
<input name="<%=Choice_id%>" type="radio" value="3" />
</div></td>
<td width="8%" class="txtContent11">
<div align="center">
<input name="<%=Choice_id%>" type="radio" value="2" />
</div></td>
<td width="8%" class="txtContent11"><div align="center">
<input name="<%=Choice_id%>" type="radio" value="1" />
</div></td>
</tr>
<tr> <%
rs2.movenext
i=i+1
loop
rs2.close
%>
<td height="5" colspan="7" class="txtContent11"><img src="image/cc_blank.gif" width="50" height="5" /></td>
</tr>
<%
rs1.movenext
i=i+1
loop
rs1.close
%>
</table></th>
</tr>
<tr bgcolor="#316AC5">
<th colspan="7" align="left" bgcolor="#669900" class="txtcontentM5" scope="row"> </th>
</tr>
<tr>
<th width="6" class="txtContent11" scope="row"> </th>
<td width="378" class="txtContent11"> </td>
<td width="53" class="txtContent11"><input name="id_eva" type="hidden" id="id_eva" value="<%=adminid%>" /></td>
<td width="53" class="txtContent11"> </td>
<td width="76" class="txtContent11"> </td>
<td width="62" class="txtContent11"><input name="Submit" type="submit" class="txtDate" value="Submit" /></td>
<td width="48" class="txtContent11"><input name="Reset" type="reset" class="txtDate" id="Reset" value="Reset" /></td>
</tr>
</form>
</table>
แก้โคดให้เรียกคำถาม ถูกแล้วครับ
แต่ตอนส่งค่าจะไปเก็บยังไงครับ
|
ประวัติการแก้ไข 2011-05-19 21:06:35
|
|
|
|
Date :
2011-05-19 21:03:52 |
By :
sataff |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|