怎么循环获取复选框的值新增到数据库中 30
<tr><td><inputtype="checkbox"name="rolelist"value="<%=rs("bukrs")%>"<%ifinstr(rolelis...
<tr><td>
<input type="checkbox" name="rolelist" value="<%=rs("bukrs")%>" <%if instr(roleliststr,"," & rs("bukrs") & ",") > 0 then%>checked<%end if%> %>
</td><td><%=rs("rolename")%></td></tr> 展开
<input type="checkbox" name="rolelist" value="<%=rs("bukrs")%>" <%if instr(roleliststr,"," & rs("bukrs") & ",") > 0 then%>checked<%end if%> %>
</td><td><%=rs("rolename")%></td></tr> 展开
1个回答
2016-06-13
展开全部
如复选框name="cid"
<%
cids = request.Form("cid")
if cids <> "" then
arr = split(cids,",")
for i=0 to ubound(arr)
'插入数据库代码
set rs = server.CreateObject("adodb.RECORDSET")
sql = "select * from tab"
rs.open sql,conn,1,3
rs.addNew
rs("cid") = arr(i)
rs.update
rs.close
set rs = nothing
next
end if
%>
<%
cids = request.Form("cid")
if cids <> "" then
arr = split(cids,",")
for i=0 to ubound(arr)
'插入数据库代码
set rs = server.CreateObject("adodb.RECORDSET")
sql = "select * from tab"
rs.open sql,conn,1,3
rs.addNew
rs("cid") = arr(i)
rs.update
rs.close
set rs = nothing
next
end if
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询