السلام عليكم ورحمه الله
الله يعطيكم العافية
أريد خبير في ASP
عندي مشروع ب asp
وهو عبارة عن امتحان الكتروني
ولكن عندي مشكلة عند حفظ إجابات المستخدم لا استطيع تحديد أيه Radio bottun checked
حاولت رفع الملفات ولكن لم استطع لذلك نسخت كود الامتحان exam.asp
قاعدة البيانات access
فيها جدولين Questions , Answer
هذا كود ال exam.asp
<!--#include file="Connection.asp"-->
<html dir="rtl">
<head>
<script language = "JavaScript">
function getRadioValue(radioObject) {
for (var i=0; i<radioObject.length; i++) {
if (radioObject.checked) {
var answer = radioObject.value;
break ;
}
}
return answer
}
</script>
<title> Electronic Computer Network Exam </title>
</head>
<body >
<p align="center"><i><b><font color="#432896" size="6" face="Comic Sans MS">Computer Network Exam </font></b></i></p>
<table dir= rtl border="0" width="100%" id="table1">
<%
if request("do")="next" then
i=request("i")
i=i+1
elseif request("do")="pervious" then
i=request("i")
i=i-1
else
i=2
end if
selectSQL="select * from question "
Dim oRecordset
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3 'adUseClientrs.CursorLocation = 3 ' adUseClient
rs.pagesize=1
rs.open selectSQL,ado
if cint(i)>rs.pagecount+1 then
'update_Answer()
response.write "end of questions.............." & rs.pagecount &"?"
response.redirect("result.asp")
end if
rs.AbsolutePage=i-1
if cint(i)<2 then
response.redirect ("exam2.asp")
end if
if NOT rs.EOF then
%>
<tr>
<td align="left" height="19"><p>
<font color="#800000" face="Times New Roman"><%=rs.FIELDS("Question").VALUE%> </font> </td>
<td width="67" height="19"><font color="#800000"><b> <font face="Times New Roman"><%=rs.FIELDS("Q_ID").VALUE%></font>
<INPUT type=hidden value=<%=rs.FIELDS("Q_ID").VALUE%> name="m"></b> </font>
<font face="Times New Roman"> <b><font color="#800000"> Q</font></b></font></td>
</tr>
<form method="get" name="answer_form">
<tr>
<td align="left"><font face="Times New Roman"><%=rs.FIELDS("a").VALUE%></font></td>
<td width="67"><font color="#000080" face="Times New Roman">
<INPUT type="radio" value="1" name="R1" style="font-weight: 700"><b>a</b></font> </td>
</tr>
<tr>
<td align="left"><font face="Times New Roman"><%=rs.FIELDS("b").VALUE%></font></td>
<td width="67"><font color="#000080" face="Times New Roman">
<INPUT type="radio" value="2" name="R1" style="font-weight: 700"><b>b</b></font></td>
</tr>
<tr>
<td align="left"><font face="Times New Roman"><%=rs.FIELDS("c").VALUE%></font></td>
<td width="67"><font color="#000080" face="Times New Roman">
<INPUT type="radio" value="3" name="R1" style="font-weight: 700"><b>c</b></font></td>
</tr>
<tr>
<td align="left"><font face="Times New Roman"><%=rs.FIELDS("d").VALUE%></font></td>
<td width="67"><font color="#000080" face="Times New Roman">
<INPUT type="radio" value="4" name="R1" style="font-weight: 700"><b>d</b></font></td>
</tr>
</form >
<script LANGUAGE="JavaScript"><!--BEGIN HIDING
radio=getRadioValue(answer_form.R1)
alert(getRadioValue(answer_form.R1))
//END HIDING-->
</SCRIPT>
<form>
<tr>
<td>
<p align="left">
<input type="checkbox" name="MyCheck<%=i%>" value="<%=rs.FIELDS("Q_ID").VALUE%>" style="float: left">mark</p>
</td>
</tr>
<input type="hidden" name="counter" value="<%=i%>">
<%
update_Answer()
%>
</form>
<%
if request("do")="review" then
response.redirect("review.asp")
end if
%>
<%
if request("do")="end" then
response.redirect ("result.asp")
end if
%>
<%
end if
%>
</table>
<TABLE id=table2 style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-COLLAPSE: collapse; BORDER-RIGHT-WIDTH: 0px" borderColor=#111111 height=1 cellSpacing=0 cellPadding=0 width=749 align=left border=1>
<TBODY>
<TR>
<TD style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none" align=middle width=97 height=1>
<FORM method=POST action="?do=next" >
<INPUT type=hidden value=<%=i%> name="i">
<P align=center> <INPUT style="FONT-SIZE: 14pt; FLOAT: right" type=submit value=" NEXT" name=NEXT ></P>
</FORM>
</TD>
<TD style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none" align=middle width=154 height=1>
<form method="POST" action="?do=pervious">
<INPUT type=hidden value=<%=i%> name="i">
<INPUT style="FONT-SIZE: 14pt; FLOAT: right" type=submit value=PERVIOUS name=PERVIOUS>
</form>
</TD>
<TD style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none" align=middle width=103 height=1>
<form method="POST" action="?do=review">
<input type="submit" value="Review" name="Review" style="font-size: 14pt; float:right">
</form>
</TD>
<TD style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none" align=middle width=219 height=1>
<FORM method=POST action="?do=end"><P>
<INPUT style="FONT-SIZE: 14pt; FLOAT: left" type=submit value="END " name="END "></P>
</FORM>
</TD>
</TR>
</TBODY>
<% 'update_Answer()%>
</TABLE>
<%
Sub update_Answer()
r=request("radio")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT answer.* FROM answer WHERE Q_ID="&(rs.FIELDS("Q_ID").VALUE-1)
'Reset server objects
rs.Close
Set rs = Nothing
Set rs = Server.CreateObject("ADODB.Recordset")
'Set the cursor type we are using so we can navigate through the recordset
rs.CursorType = 2
'Set the lock type so that the record is locked by ADO when it is updated
rs.LockType = 3
'Open the recordset with the SQL query
rs.Open strSQL, ado
'Update the record in the recordset
rs.Fields("user_answer")=cint®
'Write the updated recordset to the database
rs.Update
'Reset server objects
rs.Close
Set rs = Nothing
Set adoCon = Nothing
End Sub
%>
</body>
</html>
ملف connection.asp code
<%
'Create an ADO connection object
Set ado =Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
ado.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\database\project.mdb;Persist Security Info=False"
'Create an ADO recordset object
Set rs = Server.CreateObject("ADODB.Recordset")
%>
help me if you can
thanks in advance
شكراً