山特 可乐满:asp提交问题?

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/30 03:43:47
<!--#i nclude file="conn.asp"-->
<%
if request("action")="reg" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from user where name='"&trim(request("name"))&"'",conn,1,1
if rs.recordcount>0 then
response.write "<Script language='JavaScript'>window.alert('您输入的用户名已存在,请返回重新输入!');history.back(-1);</Script>"
response.End()
end if
sql="select * from user"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
rs("name")=trim(request.Form("name"))
rs("pwd")=trim(request.Form("pwd"))
rs("wenti")=trim(request.Form("wenti"))
rs("daan")=trim(request.Form("daan"))
rs.update
rs.close
set rs=nothing
response.write "<script language=javascript> alert('注册成功,点击确定立即登录!');location.replace('login.asp');</script>"
response.end
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body><!--#i nclude file="top.asp"-->
<table width="90%" border="1" align="center" cellpadding="10" cellspacing="0">
<tr>
<td>用户注册
<form name="form1" method="post" action="?action=reg" onsubmit="return chkform(this)">

---------------------------------------------------------------
本文中如果写成action="?action=reg" 是提交到本页中的意思吗???

request("action")="reg"为什么会接收上一行中代码的值???
那写成action="?action=reg"为什么会提交给本页呢?不是提交到其他页吗?

这相当于是,GET提交与POST提交同时进行!
所以request("action")的值应为REG,但是如果改成request.form("action")就返回空!