神人来帮忙看下asp复选框写库问题。。。

来源:百度知道 编辑:UC知道 时间:2024/05/30 16:08:51
我写的如下:
<body>
<form>
<input type="checkbox" name="alarm" value="2" checked="checked">
123
<input type="checkbox" name="alarm" value="3" checked="checked">
231
<input type="checkbox" name="alarm" value="1" checked="checked">
312</form>
<input type="submit" value="提交" >
<%
a=request.Form("alarm")
b=split(a,",")
for i=0 to UBound(b)
response.write i &ubound(b)
if i=0 then m=b(i)
if i<>0 then m=m&","&b(i)
next
m="("&m&")"
flag=1
strsql="update db_alarm_table set flag=1 where id in "&m
set rs=conn.Execute(strsql)

%>
</body>
不知道哪里错了,请高手帮忙看看。
一下两位大侠的方法都试过了。。。还是不好使。。。。!

你的表单提交要提交那个页面你都没有写,以那种方式提交也没有
a=request.Form("alarm") 这样肯定取不到值的

<form action="(你要提交的页面)" method="POST">
<input type="checkbox" name="alarm" value="2" checked="checked">
123
<input type="checkbox" name="alarm" value="3" checked="checked">
231
<input type="checkbox" name="alarm" value="1" checked="checked">
312</form>

如果你的method="post"就可以用request.form 如果是method="get" 就得用request.querystring

<%
dim a,b,i
a=request.Form("alarm") 'alarm提交过来的值,还会带有一个空格,就是这样的:1, 2, 3
if a<>"" then
a=replace(a," ","") '过滤空格
strsql="update db_alarm_table set flag=1 where id in ("&a&")"
set rs=conn.Execute(strsql)
end if
%&