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 > ASP > ASP Forum > ทำแบบสอบถามแบบมีหลายกลุ่มคำถามดึงจากฐานข้อมูล และเป็น Radio



 

ทำแบบสอบถามแบบมีหลายกลุ่มคำถามดึงจากฐานข้อมูล และเป็น Radio

 



Topic : 060389

Guest




pollform

ผมทำแบบสอบถามเป็นแบบให้คะแนน 1-5 ครับ


โดยคำถามมีหลายกลุ่ม
ผมลองทำดูแล้วติดที่ มันคลิกได้ทีละ2 อันเอง
และอีกอย่าง การส่งค่าไปเก็บ
ใน ฟอร์ม มันจะส่งได้แต่ค่าคะแนน แล้ว id ของหัวข้อสอบถาม จะส่งยังไงครับ
ผมจะเก็บแบบ ID แบบสอบถาม คะแนน ID ผู้ประเมิน
หรือจะเก็บยังไงดีครับ หัวจะระเบิดแล้วววว
อันเก่าที่ถามก็ยังไม่เสร็จเอาอันใหม่มาให้ทำอีกแล้ว เค้าไม่ใช่โปรแกรมเมอร์นะ T_T
ลอง search ดูละครับ มันไม่มีแบบ แบ่งกลุ่มแบบนี้อ่ะครับ


Code (ASP)
<table width="794" 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">&nbsp;</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">&nbsp;</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") %>
            <%do while not rs1.eof %><table width="794" border="0" cellpadding="0" cellspacing="0" bgcolor="#F3F3F3">
              <tr bgcolor="#FF0000">
                <td height="20" colspan="7" bgcolor="#CCCCCC" class="txt14Bblack">&nbsp;<%=rs1("Group_name")%>
                   
               <%
		
			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 
			'sh1_id=rs1("sh1_id")
%>                </td>
              </tr>
           
              <%do while not rs2.eof %>
              <tr>
                <td width="4%" height="20" class="txtcontentM4"><div align="right"></div></td>
                <td width="56%" bgcolor="#FFFFFF" class="txtContent11"><span class="txtContent11"><%=rs2("Choice_name")%><%Choice_id=rs2("Choice_id")%></span></td>
                <td width="8%" bgcolor="#FFFFFF" class="txtContent11">
                  <div align="center">
                    <input name="<%=Choice_id%>" type="radio" value="5" />
                    </div></td><td width="8%" bgcolor="#FFFFFF" class="txtContent11"><div align="center">
                      <input name="<%=Choice_id%>" type="radio" value="4" />
                    </div></td>
                <td width="8%" bgcolor="#FFFFFF" class="txtContent11"><div align="center">
                  <input name="<%=Choice_id%>" type="radio" value="3" />
                </div></td>
                <td width="8%" bgcolor="#FFFFFF" class="txtContent11"><div align="center">
                  <input name="<%=Choice_id%>" type="radio" value="2" />
                </div></td>
                <td width="8%" bgcolor="#FFFFFF" class="txtContent11"><div align="center">
                  <input name="<%=Choice_id%>" type="radio" value="1" />
                </div></td>
              </tr>
              <%			
							rs2.movenext
						   	i=i+1                                          
						   	loop
						   	rs2.close	
%>
          <%			
							rs1.movenext
						   	i=i+1                                          
						   	loop
					
%>
            </table>
    </th>
        </tr>
        <tr bgcolor="#316AC5">
         
          <th colspan="7" align="left" bgcolor="#669900" class="txtcontentM5" scope="row">&nbsp;</th>
        </tr>
        <tr>
          <th width="24" class="txtContent11" scope="row">&nbsp;</th>
          <td width="389" class="txtContent11">&nbsp;</td>
          <td width="71" class="txtContent11"><input name="id_eva" type="hidden" id="id_eva" value="<%=adminid%>" /></td>
          <td width="71" class="txtContent11">&nbsp;</td>
          <td width="94" class="txtContent11">&nbsp;</td>
          <td width="61" class="txtContent11"><input name="Submit" type="submit" class="txtDate" value="Submit" /></td>
          <td width="60" class="txtContent11"><input name="Reset" type="reset" class="txtDate" id="Reset" value="Reset" /></td>
          </tr>
      </form>
    </table>




Tag : ASP, Ms Access







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-05-19 14:27:52 By : b View : 1634 Reply : 3
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

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

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

จะต้องตั้งชื่อ 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
 


 

No. 2



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



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


หรือเปลี่ยนวิธีเขียนดีครับพี่วิน
แล้วเวลาส่งค่า มันจะส่งไปเป็นค่าเฉพาะ value แล้วถ้าเราจะเอา ID ของแต่ละข้อไปด้วยครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-05-19 18:21:52 By : b
 

 

No. 3



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



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


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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;<%=rs1("Group_name")%></span>
                    <%Group_id=rs1("Group_id")%>
                  &nbsp;
                  <%'/////////////////////////////////////////////////////////////////////////////////////////////////%>
                  <span class="style4">&nbsp;</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">&nbsp;</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">&nbsp;</th>
        </tr>
        <tr>
          <th width="6" class="txtContent11" scope="row">&nbsp;</th>
          <td width="378" class="txtContent11">&nbsp;</td>
          <td width="53" class="txtContent11"><input name="id_eva" type="hidden" id="id_eva" value="<%=adminid%>" /></td>
          <td width="53" class="txtContent11">&nbsp;</td>
          <td width="76" class="txtContent11">&nbsp;</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
 

   

ค้นหาข้อมูล


   
 

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