我快疯了,我的代码什么地方有问题?

wei_as 2002-03-11 12:30:39
我有newusercheck.asp用户注册和 newuseradd.asp检查填写是否正确,正确就把用户信息写入数据库。
newusercheck.asp
-------------------------------------------------------------------------


<P class="FONT"><font
size=2>为了我们更好的为您服务,更准确及时的将您订购的商品送到您的手中和与您联系,请您务必详细填写您的信息,并核对无误;
国内用户请留下您的真实中文姓名。<BR>请放心:您的资料未经您的允许,我们将只用于处理您的订货信息,对外保密。 <FONT
face=Arial>(</FONT>带</font><FONT color=#ff0000><STRONG>
*</STRONG></FONT>
<font size=2>号为必填项<FONT face=Arial>)</FONT></font></P>
<p><TABLE border=1 cellPadding=1 cellSpacing=1 width="318" align="center">

<TR>
<TD class="FONT" width="40%"><font
face="Small Fonts"><font size=2>昵称<FONT color=#ff0000><STRONG>
*</STRONG></FONT></font></font></TD>
<TD width="228"><input type="text" name="nicename" size="20" ID=Text6>
</TD></TR>

<TR>
<TD class="FONT" width="74"><font size=2>姓名<FONT color=#ff0000><STRONG>

*</STRONG></FONT></font></TD>
<TD width="228"><input type="text" name="name" size="20" ID=Text1>
</TD></TR>
<TR>

<TD class="FONT" width="74"><font size=2>联系电话<FONT color=#ff0000><STRONG>
*</STRONG></FONT></font></TD>
<TD width="228"><input type="text" name="tel" size="20" ID=Text2></TD></TR>
<TR>

<TD class="FONT" width="74"><font size=2>联系地址<FONT color=#ff0000><STRONG>
*</STRONG></FONT></font></TD>
<TD width="228"><input type="text" name="addr" size="20" ID=Text3></TD></TR>
<TR>

<TD class="FONT" width="74"><font size=2>E_mail:<FONT color=#ff0000><STRONG>
*</STRONG></FONT></font></TD>
<TD width="228"><input type="text" name="email" size="20" ID=Text4></TD></TR>
<TR>

<TD class="FONT" width="74"><font size=2>邮编:</font><FONT color=#ff0000><STRONG><font
size=2>*</font>
</STRONG></FONT></TD>
<TD width="228"><input type="text" name="zip" size="20" ID=Text5></TD></TR>
<TR>

<TD class="FONT" width="74"><font size=2>密码:<FONT color=#ff0000><STRONG>*
</STRONG></FONT></font></TD>
<TD width="228"><input type="password" name="password1" size="20" ID=Password1></TD></TR>
<TR>

<TD class="FONT" width="74"><font size=2>确认密码<FONT color=#ff0000><STRONG>
*</STRONG></FONT></font></TD>
<TD width="228"><input type="password" name="password2" size="20" ID=Password2></TD></TR></TABLE> </p>

-------------------------------------------------------------------------


newuseradd.asp
-------------------------------------------------------------------------

<%@ Language=VBScript %>
<%option explicit
connstr="dbq=" & server.MapPath("mobile.mdb") & ";driver={microsoft access driver (*.mdb)};"

set conn=server.CreateObject("adodb.connection")
conn.Open connstr
set rs=server.CreateObject("adodb.recordset")
dim nicename,name,tel,addr,email,zip,pw1,pw2,temp
dim founderr,errmsg
founderr=false
name=Request.Form("name")
if name="" then
founderr=true
errmsg="姓名不能为空"
end if
tel=Request.Form("tel")
if tel="" then
founderr=true
errmsg=errmsg & "联系电话不能为空"
end if
addr=Request.Form("addr")
if addr="" then
founderr=true
errmsg=errmsg & "联系地址不能为空"
end if
email=Request.Form("email")
if email="" then
founderr=true
errmsg=errmsg & "e-mail不能为空!"
end if
zip=Request.Form("zip")
if zip="" then
founderr=true
errmsg=errmsg & "邮编不能为空!"
end if
pw1=Request.Form("password1")
pw2=Request.Form("password2")
if (pw1="" or pw1<>pw2) then
founderr=true
errmsg=errmsg & "密码错误!"
end if

nicename=request.form("nicename")

if nicename="" then
founderr=true
errmsg="非法的用户名!"

end if

sql="select * from user where nicename='" & nicename & "'"
rs.Open sql,conn,1,1
if rs.RecordCount>0 then
founderr=true
errmsg="此用户名已注册!"
end if

if founderr then
Response.Write errmsg
%>
(略)

<%else
添加记录(略)

<% end if%>
-------------------------------------------------------------------------


我在注册页面填了详细的信息,然后点确定,结果返回“E-mail不能为空”的信息。但是我email可是填了啊!我看了半天觉得代码好象没有什么问题。 你们看看,是不是我什么地方疏忽了。


...全文
38 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
lbwj 2002-03-12
  • 打赏
  • 举报
回复
<FONT
face=Arial>(</FONT>带</font><FONT color=#ff0000><STRONG>
*</STRONG></FONT>
以上的内容,如何解释
tonnycncn 2002-03-11
  • 打赏
  • 举报
回复
表面上没什么错,最好再提交一次,看看结果。
tonnycncn 2002-03-11
  • 打赏
  • 举报
回复
newusercheck.asp
为何这里连form都没有?

建议表单提交的判断用javascript!!
lisa_lee 2002-03-11
  • 打赏
  • 举报
回复
用JAVASCRIPT判断好一些,也简单一些。
songzx66 2002-03-11
  • 打赏
  • 举报
回复
<%@ Language=VBScript %>
<%option explicit
dim connstr,conn,rs
connstr="dbq=" & server.MapPath("mobile.mdb") & ";driver={microsoft access driver (*.mdb)};"

set conn=server.CreateObject("adodb.connection")
conn.Open connstr
set rs=server.CreateObject("adodb.recordset")
dim nicename,name,tel,addr,email,zip,pw1,pw2,temp
dim founderr,errmsg
founderr=false
name=Request.Form("name")
if name="" then
founderr=true
errmsg="姓名不能为空"
end if
tel=Request.Form("tel")
if tel="" then
founderr=true
errmsg=errmsg & "联系电话不能为空"
end if
addr=Request.Form("addr")
if addr="" then
founderr=true
errmsg=errmsg & "联系地址不能为空"
end if
email=Request.Form("email")
if email="" then
founderr=true
errmsg=errmsg & "e-mail不能为空!"
end if
zip=Request.Form("zip")
if zip="" then
founderr=true
errmsg=errmsg & "邮编不能为空!"
end if
pw1=Request.Form("password1")
pw2=Request.Form("password2")
if (pw1="" or pw1<>pw2) then
founderr=true
errmsg=errmsg & "密码错误!"
end if

nicename=request.form("nicename")

if nicename="" then
founderr=true
errmsg="非法的用户名!"

end if

sql="select * from user where nicename='" & nicename & "'"
rs.Open sql,conn,1,1
if not rs.eof and not rs.bof then
founderr=true
errmsg="此用户名已注册!"
end if

if (founderr) then
Response.Write errmsg
%>
<%else
'添加记录(略)
%>
<%end if%>
wei_as 2002-03-11
  • 打赏
  • 举报
回复
还是没解决,你门在帮我看看。
forestli 2002-03-11
  • 打赏
  • 举报
回复
我的建议是你用一个表单提交到你的下一个页面,你试一下,不行的话在问
playmud 2002-03-11
  • 打赏
  • 举报
回复
关掉ie,重新打开试一次!
蓝诺 2002-03-11
  • 打赏
  • 举报
回复

newusercheck.asp
为何这里连form都没有?

建议表单提交时判断用javascript!!VBscript都可以!
wei_as 2002-03-11
  • 打赏
  • 举报
回复
我试了n次还是这样,把机子重起在试还是这样。冒的办法了。

28,406

社区成员

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

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