|
我用asp做了个动态复选框,表单代码如下:<form name="form1" class="form2" id="form1" action="/form action/hdxx_action.asp">
<table width="629" border="1" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="108" bgcolor="#FFFFFF"><div align="center">类型</div></td>
<td width="195" bgcolor="#FFFFFF"><div align="center">活动</div></td>
<td width="103" bgcolor="#FFFFFF"><div align="center">时间</div></td>
<td width="60" bgcolor="#FFFFFF"><div align="center">容量</div></td>
<td width="60" bgcolor="#FFFFFF"><div align="center">已选人数</div></td>
<td width="46" bgcolor="#FFFFFF"><div align="center">选定</div></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset2.EOF))
%>
<tr>
<td bgcolor="#FFFFFF"><div align="center"><%=(Recordset2.Fields.Item("type").Value)%></div></td>
<td bgcolor="#FFFFFF"><div align="center"><%=(Recordset2.Fields.Item("name").Value)%></div></td>
<td bgcolor="#FFFFFF"><div align="center"><%=(Recordset2.Fields.Item("time").Value)%></div></td>
<td bgcolor="#FFFFFF"><div align="center"><%=(Recordset2.Fields.Item("num").Value)%></div></td>
<td bgcolor="#FFFFFF"><div align="center"></div></td>
<td bgcolor="#FFFFFF"><div align="center">
<input type="checkbox" name="choose" value="<%=(Recordset2.Fields.Item("id").Value)%>" id="choose" />
</div></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset2.MoveNext()
Wend
%>
</table>
<input name="vo_id" type="hidden" id="vo_id" value="<%=(Recordset1.Fields.Item("vo_id").Value)%>" />
<label for="checkbox"></label>
<div align="right"></div>
<p> </p>
<div align="center" class="form2">
<input type="submit" name="tijiao" id="tijiao" value="提交" />
</div>
</form>
其中里面的表格包括复选框是重复区域,自动读取数据库内容并插入的,但是我发现这样生成的复选框,在读取时根本读取不了,我试过用代码去读取复选框个数以及被选择的个数和值,都是0或空白的,我用下面的代码是可以读到不是重复区域生成的复选框的,但当换成上述重复区域下的复选框就读取不了,请问大神该怎样解决:
<%
chooses=Request.Form("choose")
if chooses="" then
response.write"<script language=JavaScript>window.alert('对不起,您没有选择任何活动,请选择后再提交!');window.location.href='../vohdxx.asp';</script>"
else
arr = split(chooses,",")
set conn=server.createobject("adodb.connection")
conn.open "Driver={Microsoft Access Driver (*.mdb)};DBQ="&server.MapPath("../database/vouser.mdb")
for i=0 to ubound(arr)
set rs=server.CreateObject("adodb.recordset")
sql = "select * from [vo_activity] where id is null"
rs.open sql,conn,1,3
rs.addNew
rs("activity_id") = arr(i)
rs("vo_id")=request.Form("vo_id")
rs.update
rs.close
set rs = nothing
next
End if
response.write"<script language=JavaScript>window.alert('成功提交活动选择!');window.location.href='../vohdxx.asp';</script>"
response.end
%> |
|