日期:2014-05-17  浏览次数:20921 次

用户注册为何没有反映?谁给个简单的方法?解决能够写入数据库就好
代码如下;
http://127.0.0.1:10322/asp/account/email/register.asp

VB code
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>

<!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=gb2312" />
<title>无标题文档</title>
</head>

<body>
<script language = "VBScript">
function ChkFields()
    name = document.MyForm.user.value
   If document.MyForm.UserName.value ="" Then
           window.alert("请输入用户名!")
           return false
   End If
   If document.MyForm.pass.value ="" Then
           window.alert("请输入密码!")
           return false
   End If
   If document.MyForm.email.value = "" Then
           window.alert("请输入电子邮件!")
        return false
   End If
   return true
End Function
</script>
<form id="form1" name = "MyForm" method="post" action="save.asp">
  <p>用户名
    <input name="user" type="text" id="user" />
  </p>
  <p>邮箱
    <input name="email" type="text" id="email" />
</p>
  <p>
    密码
      <input name="pass" type="text" id="pass" />
  </p>
  <p>
    确认密码
      <input name="pass2" type="text" id="pass2" />
      </p>
  <p>
    <input type="submit" name="Submit" value="提交" onclick = ChkFields()/>
    <input type="reset" name="Submit2" value="重置" />
  </p>
</form>
</body>
</html>



save.asp
VB code
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Conn.asp"-->
<!--#include file = "md5.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=gb2312" />
<title>无标题文档</title>
</head>

<body>
<%
name=Trim(Request.Form("name"))
pass=md5(Trim(Request.Form("pass")))
email=Trim(Request.Form("email"))
Set rs = server.CreateObject("adodb.recordset")
sql="select * from  user name="&name&"  and email="&email&""
rs.Open sql, conn, 1,3
if rs.eof then
rs.addnew
rs(name)=name
rs(pass)=pass
rs(email)=email
rs.update
end if 
%>
</body>
</html>



------解决方案--------------------
sql="select * from user name='" & name & "' and email='" & email & "'"

------解决方案--------------------
sql="select * from user where name='" & name & "' and email='" & email & "'"
------解决方案--------------------
sql="select * from user where name='"&name&" ' and email='"&email&"'";