狐狸可以家养吗:一段关于表单的asp代码求助

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/28 17:08:47
<html>
<body>
<%
response.expires=0
if request.servervariables("content_length") <> 0 then
strname=trim(request.form("yourname"))
strsex=trim(request.form("sex"))
strliuyan=trim(request.form("message"))
strmessage=replace(strliuyan,vbcr1f,"<br>"& vbcr1f)
%>
<html>
<body>
您的姓名:<%=strname%><br>
性别:<%=strsex%><br>
留言:<br><br><br>
<%=strmessage%><br><br><br>
<%
response.write"您共选择了" & request.form("hobby").count &"2项爱好:" &"<br>"
for i=1 to request.form("hobby").count
response.write request.form("hobby")(i) & "<br>"
next
%>
</body>
</html>
<% else %>
<html>
<body>
<form method="post" action=
"<%=request.servervariables("script_name")%>">
姓名:<input type="text" name="yourname"><br>
性别:<select name="sex">
<option>男</option>
<option>女</option>
</select><br>
留言:<textarea name="message"> 欢迎
请填写完您的留言</textarea><br>
您的爱好有:<br>
<input name="hobby" type="checkbox" value="体育">体育
<input name="hobby" type="checkbox" value="购物">购物
<input name="hobby" type="checkbox" value="阅读">阅读
<br>
<input type="submit" name="submit1" value="提交">
<input type="reset" name="submit2" value="重置">
</form>
</body>
</html>
<%end if%>
我是刚刚才接触asp的,这段代码是我一本书上的例子,可是放在我的电脑的wwwroot文件夹下却不能正常显示,我是想在文本框里将姓名,性别等信息都输进去,按下提交按钮后就显示刚刚输入的内容,不知道那里有问题,好急啊,谁能帮帮我啊,谢谢!!!

不要那么复杂,你试试这个。
<%If request.form.count>0 then
response.write Request("hello")
end if%>
<form method="post" action="" name="form1">
<input type="text" name="hello">
</form>