怎样取得提交的form表单中的复选框数据

< html >
< head >
< meta  http-equiv ="Content-Type"  content ="text/html; charset=gb2312" >
< title > 无标题文档 title >
head >

< body >
< form  action ="test.asp"  method ="get"  name ="form1" >
< input  name ="fruit"  type ="checkbox"  value ="香蕉" >  香蕉 < br />
< input  name ="fruit"  type ="checkbox"   value ="苹果" >  苹果  < br />
< input  name ="fruit"  type ="checkbox"   value ="菠萝" >  菠萝  < br />
< input  name ="fruit"  type ="checkbox"   value ="柑橘" >  柑橘 
< input  type ="submit"  name ="submit"  value ="订购"   >
form >
<%  
if request.querystring("fruit")="" then
response.Write 
"您没有订购水果"
else
response.Write 
"您订购了"&"
"
for i=1 to request.QueryString("fruit").count
response.Write request.querystring(
"fruit")(i) &"
"
next
   
end if 
%>

body >
html >
< html >
< head >
< meta  http-equiv ="Content-Type"  content ="text/html; charset=gb2312" >
< title > 无标题文档 title >
head >

< body >
< form  action ="test.asp"  method ="post"  name ="form1" >
< input  name ="fruit"  type ="checkbox"  value ="香蕉" >  香蕉 < br />
< input  name ="fruit"  type ="checkbox"   value ="苹果" >  苹果  < br />
< input  name ="fruit"  type ="checkbox"   value ="菠萝" >  菠萝  < br />
< input  name ="fruit"  type ="checkbox"   value ="柑橘" >  柑橘 
< input  type ="submit"  name ="submit"  value ="订购"   >
form >
<%  
if request.form("submit")="订购" then
 
if request.form("fruit")="" then
 response.Write 
"您没有订购水果"
 
else
 response.Write 
"您订购了 "&request.form("fruit")
 
end if

   
end if 
%>

body >
html >
 

你可能感兴趣的:(WEB)