成绩录入页面动态生成文本框及数据提交代码请教
我是自己在学ASP,现在想做个成绩录入的页面,希望实现通过选择班级后自动获取该班学生姓名(已搞定),然后在姓名后动态生成一个文本框以输入成绩,我现在不知道如何将各学生的成绩对应传递至成绩表(exam)中保存,希望获得大家帮助,在此先谢谢啦!我的半成品代码如下(自学的,代码可能有点乱)。<form action="entry.asp" method="post">
<table class='datalist' width="900" height="50" border="0" align="center" cellpadding="0" cellspacing="0">
<tr class='datalist th'>
<th colspan='5'>请在下面选择、录入成绩信息</th>
</tr>
<tr class='datalist td'>
<td>班 级:
<!--读取班级信息-->
<%
set rs=server.CreateObject("ADODB.RecordSet")
Source="select * from class order by id_bj"
rs.Open Source,conn,1,1
Response.write "<select name='classxx'>"
Do While Not rs.EOF
Response.Write "<option value='"& rs("classxx") &"'>"& rs("classxx") &"</option>"
rs.MoveNext
Loop
Response.Write "</select>"
%>
</td>
<td>学 科:
<!--读取学科信息-->
<%
set rs=server.CreateObject("ADODB.RecordSet")
Source="select * from subject order by id_xk"
rs.Open Source,conn,1,1
Response.write "<select name='subjectxx'>"
Do While Not rs.EOF
Response.Write "<option value='"& rs("subjectxx") &"'>"& rs("subjectxx") &"</option>"
rs.MoveNext
Loop
Response.Write "</select>"
%>
<!--按照条件进行查询学生-->
<%
dim bj,xk,xm,xjh
bj= Request.Form("classxx")
xk= Request.Form("subjectxx")
set rs=server.CreateObject("ADODB.RecordSet")
Source = "select * from student where class='"&bj&"' order by id_xs"
rs.Open Source,conn,1,1
%>
</td>
<td><font color="#FF0000">请输入考试题目信息</font></td>
<td colspan="2"><input name="title" type="text" id="" style="width:180;">如:2016年春四年级半期考试成绩</td>
</tr>
<tr class="datalist th">
<%
if rs.eof and rs.bof then
response.Write("没有学生信息!")
else
i=0
Do Until rs.Eof
%>
<td> <%=i+1%>、<%=rs("xsname")%> <input name="score" type="text" id="score" style="width:20;" size="6" maxlength="6">
<%
i=i+1
if i mod 5=0 then
Response.Write"</td></tr><br>"
end if
rs.MoveNext
Loop
end if
%>
<tr class="datalist td">
<th colspan='5'><input type="submit" name="Submit" value="提交" /><input type="reset" name="Submit2" value="重置" /></th>
</tr>
</table>
</form>
[此贴子已经被作者于2016-4-22 21:21编辑过]