asp程序提交自身处理

来源:百度知道 编辑:UC知道 时间:2024/06/14 08:50:22
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>注册界面</title>
</head>
<% dim username,userpass,userpass1
username=trim(request("username"))
userpass=trim(request("userpass"))
userpass1=trim(request("usserpass1"))
if username="" or userpass="" then
response.Redirect("err.asp?

你的问题1,,因为你是一进页面就检查的...你应该弄一个if你提交后就检查,,

你的问题2,你的字段是userpass1=trim(request("usserpass1"))后面多了个s你写成了u"s"serpass1

我通常是这样写

select case request("action")
case "add":add()
case "addsave":addsave()
case ......
case else
.....
end select
sub add()
<form method="post" action="?action=addsave" name="form2">
.....'显示提交表单
end sub
sub addsave()
....'数据处理
end sub
sub ....'处理其他
end sub

多加个if语句,第一次进入的时候用户名肯定为空,就可以跳过这段了.
<% dim username,userpass,userpass1
username=trim(request("username"))
userpass=trim(request("userpass"))
userpass1=trim(request("usserpass1"))
if username<>"" then
if userpass="" then
response.Redirect("err.asp?info=密码不能为空")
end if
if userpass<>userpass1 then