Form提交输出

ylczy 2005-10-13 04:26:31
提交Form时,输入选择的值。下面出在那儿,麻烦改改。

<html>
<head>
<title>Redirect示例</title>
</head>
<body>
<%
'Response.write Request("wheretogo")
if Request("wheretogo") = "" then
Response.write "值为空"
else
add= Request("wheretoto")
Response.write add
end if
%>

<form aciton="formjump.asp" method="post">
<select name="wheretogo">
<option selected value="fun">Fun</option>
<option value="news">News</option>
<option value="sample">Sample</option>
</select>
<input type=submit name="jump" value="Jump">
</form>
</body>
...全文
123 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
zuosijing 2005-10-15
  • 打赏
  • 举报
回复
发贴的人能不能把“formjump.asp”文件的源码也贴出来呀?
ylczy 2005-10-13
  • 打赏
  • 举报
回复
楼上的牛,是对的,问题解决。
无爱大叔 2005-10-13
  • 打赏
  • 举报
回复
<option value="fun" <%If(add="fun")Then%>selected<%End If%>>Fun</option>
<option value="news" <%If(add="news")Then%>selected<%End If%>>News</option>
<option value="sample" <%If(add="sample")Then%>selected<%End If%>>Sample</option>
ylczy 2005-10-13
  • 打赏
  • 举报
回复
<%
'Response.write Request("wheretogo")
if Request("wheretogo") = "" then
Response.write "值为空"
else
add= Request("wheretogo")
Response.write add
end if
%>


<html>
<head>
<title>示例</title>
</head>
<body>
<form aciton="formjump.asp" method="post">
<select name="wheretogo">
<option value="fun">Fun</option> <!--这里已经把select去掉了,可还是一样的-->
<option value="news">News</option>
<option value="sample">Sample</option>
</select>
<input type="submit" name="jump" value="Jump">
</form>
</body>
</html>
ylczy 2005-10-13
  • 打赏
  • 举报
回复
楼上的对,我把变量赋错值了。 呵呵, 搞这么久。

不过又发现一个问题就是每次FORM提交后,HTML输出时SELECT控件总是回复到第一值,有什么办法提交后保存此控件选择的状态值。
就是控件值和Response.write 的输入值显示一样。
xxgu 2005-10-13
  • 打赏
  • 举报
回复
晕~~~~~~
这种错误你也能犯
你看看你的add等于什么
if Request("wheretogo") = "" then
Response.write "值为空"
else
add= Request("wheretogo")
Response.write add
end if
无爱大叔 2005-10-13
  • 打赏
  • 举报
回复
add= Request("wheretoto")
=>
add= Request("wheretogo")
ylczy 2005-10-13
  • 打赏
  • 举报
回复
问题没有解决,楼上的代码 request.from("wheretogo") 应为 request.form("wheretogo")
页面第一次打开时,输入“值为空”字段,当选择后提交后则没有输入内容

下述我是写在一个formjump.asp文件里面的
<html>
<head>
<title>示例</title>
</head>
<body>
<%
'Response.write Request("wheretogo")
if Request("wheretogo") = "" then
Response.write "值为空"
else
add= Request("wheretoto")
Response.write add
end if
%>

<form aciton="formjump.asp" method="post">
<select name="wheretogo">
<option selected value="fun">Fun</option>
<option value="news">News</option>
<option value="sample">Sample</option>
</select>
<input type=submit name="jump" value="Jump">
</form>
</body>
</html>


satans18 2005-10-13
  • 打赏
  • 举报
回复
request.from("wheretogo")
xxgu 2005-10-13
  • 打赏
  • 举报
回复
<form aciton="" method="post">
ylczy 2005-10-13
  • 打赏
  • 举报
回复
</html> 标记没COPY上去。

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧