ASP中一个页面多个表单的提交
2004-08-19 10:17
453 查看
做网页有时我们需要将多个表单方在同一个页面
处理表单的程序页怎样才知道那个表单被提交了并作相应的处理呢?
下面是一个例子:
'''''''''''''''''''''form.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<script language="vbscript" runat="server">
sub chuli()
if request.QueryString("formid")=1 then
response.Write(request.Form("textfield"))
elseif request.QueryString("formid")=2 then
response.Write(request.Form("textfield2"))
end if
end sub
</script>
<html><head><title>一个页面多个表单的提交</title></head>
<body>
<table width="300" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><form name="form1" method="post" action="form.asp?formid=1">
<input type="text" name="textfield">
<input type="submit" name="Submit" value="提交">
</form></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><form name="form2" method="post" action="form1.asp?formid=2">
<input type="text" name="textfield2">
<input type="submit" name="Submit2" value="提交">
</form></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<%
chuli '调用服务器端过程
%>
</td>
</tr>
</table>
</body>
</html>
处理表单的程序页怎样才知道那个表单被提交了并作相应的处理呢?
下面是一个例子:
'''''''''''''''''''''form.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<script language="vbscript" runat="server">
sub chuli()
if request.QueryString("formid")=1 then
response.Write(request.Form("textfield"))
elseif request.QueryString("formid")=2 then
response.Write(request.Form("textfield2"))
end if
end sub
</script>
<html><head><title>一个页面多个表单的提交</title></head>
<body>
<table width="300" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><form name="form1" method="post" action="form.asp?formid=1">
<input type="text" name="textfield">
<input type="submit" name="Submit" value="提交">
</form></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><form name="form2" method="post" action="form1.asp?formid=2">
<input type="text" name="textfield2">
<input type="submit" name="Submit2" value="提交">
</form></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<%
chuli '调用服务器端过程
%>
</td>
</tr>
</table>
</body>
</html>
相关文章推荐
- 用一个最简单方法解决asp.net页面刷新导致数据的重复提交
- 使用WebClient自动填写并提交ASP.NET页面表单
- 一个表单提交纠错引起的问题,session在上级页面继承
- asp.net页面间传值的几种方法 表单提交 传送页面代码 复制代码 <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server
- 【转载】解決用showModalDialog弹出页面后,form表单提交再次弹出一个新窗口問題
- 一个表单两个submit提交到不同的页面
- Jquery mobile 提交表单转换到另外一个页面或者留在本页面的方案!
- 一个表单多个提交 提交同一个页面或多个不同的页面
- ASP.NET MVC 3.0:基于Ajax的表单提交,A页面认证失败后页面被强转至登录页面,待登录成功将如何回到A页面?
- ASP.NET(ASPX)页面获取form表单提交元素的值
- 如何让一个表单同时提交到两个不同的页面
- 巧用js提交表单轻松解决一个页面有多个提交按钮
- jquery的layer弹出层框架,如果设置 iframe弹出一个页面里是表单提交,提交完怎么关闭弹出层
- 在ASP.NET登录页面中如何实现文本框焦点自动跳转及通过回车键提交表单
- asp.net 中将表单提交到另一页 Code-Behind(代码和html在不同的页面)
- 在一个form用一个SUBMIT(或button)分别提交到两个处理表单页面的代码
- 使用WebClient自动填写并提交ASP.NET页面表单
- 使用WebClient自动填写并提交ASP.NET页面表单
- (转)ASP.NET MVC 3.0:基于Ajax的表单提交,A页面认证失败后页面被强转至登录页面,待登录成功将如何回到A页面?
- 关于form表单提交,如何跳转到一个带参数的页面