asp考试系统单选题出错

来源:百度知道 编辑:UC知道 时间:2024/05/20 11:56:16
问题大意:在index.asp中有10道单选题,要把结果传送到stry_result.asp,但如果有一道没有选择,这道题的答案就为空,就会把下一道题的答案传送给这道题,后面依次前提.
不知怎么解决,向各位大虾求助,先谢啦.在线等.
index.asp部分代码:由于字符个数限制,代码不全
Set rs = conn.Execute(sql)
<table><FORM action="stry_result.asp" method=post >
<table > for i=1 to 5
<TABLE > <input name=ans<%=i%>type=radio value="A">
A. <%=rs("A")%>  </td><input...> B.<%=rs("B")%...
<%rs.movenext
next%><table >
<input type=submit value="交卷"></table> </table></FORM>
stry_result.asp
<!-- #INCLUDE FILE="conn.asp" -->
<%sql="select *from test" rs.open sql,conn,3,3
dim score,i
rsCount=0 ycorrect=0
Response.Write "正确答案:"
for i=1 to 5 Response.Write rs("ans")
rsCount=rsCount + 1
response.write request.form("ans&i&

楼主想要stry_result.asp的代码?还是怎么着?没看懂您的意思
补充:
楼主的第一个页面form中的action为stry_result.asp,但是接收的面是stry_test.asp,是不是这的问题?
我给你写点stry_test.asp的代码,你看行不行
<!-- #INCLUDE FILE="conn.asp" -->
<%
set rs=createobject("adodb.recordset")
sql="select *from test"
rs.open sql,conn,3,3
Response.Write "正确答案:"
do while not rs.eof
Response.Write rs("ans")
rs.movenext
loop
Response.Write "<br> 你的答案:"
for i=1 to 5
if Request.Form("ans&i")="" then
i=i+1
next
else
response.write Request.Form("ans&i")&"<br />"
next
%>