回 帖 发 新 帖 刷新版面

主题:【表单修改后不能保存到数据库】

我从网上下了一个会员管理系统.想自己改一下,但是发现我在表单里添加几个文本输入框或者改动一点点,表单就无法保存到数据库中.(可以填写,提交,但是数据库里没有刚提交的资料)!高手们帮我看看吧!谢谢了!下面是两个页面的代码:
第一页:
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
td {  font-family: "宋体", "serif"; font-size: 9pt}
a:link {  font-size: 9pt; color: #000000; text-decoration: none}
a:hover {  font-size: 9pt; color: #FF0000; text-decoration: underline}
a:visited {  font-size: 9pt; text-decoration: none}
.unnamed1 {  font-family: "宋体", "serif"; font-size: 10.5pt}
a:active {
    text-decoration: none;
}
.STYLE1 {color: #000000}
-->
</style>

</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" vlink="#003399" alink="#CCCCCC">
<div align="right"> </div>
<table width="525" border="0" cellpadding="0" align="center" bgcolor="#cccccc" cellspacing="0">
  <tr valign="top" bgcolor="#ffffff"> 
    <td width="523" bgcolor="#ffffff"> 
      <form action=Register_3.asp method=post name="frmRegister">
        <table border=0 cellspacing=1 height=326 width="100%" cellpadding="0">
          <tbody>           
            <tr>
              <td height=25 colspan="2" align=right><div align="left"><span class="STYLE1">请认真填写你的会员资料  &nbsp;(带</span><font color=#ffffff>*</font><span class="STYLE1">号为必填字资料)</span></div></td>
            </tr>
            <tr> 
            <td align=right height=25 width="14%">会员级别:</td>
            <td height=25 width="86%"> 
              <select name=txtClass size=1>
              
                    <option value="普通会员">普通会员</option>
              
                    <option value="vip会员">vip会员</option>
              </select>
              <font color=#ff0000>*</font></td>      
          </tr>      
   
          <tr>       
            <td align=right height=18 width="14%">会员账号:</td>     
            <td height=18 width="86%">      
              <input name=txtId maxLength=15 size=15>     
              <font color=#ff0000>*</font><font color="#000000">1-15 字符,只允许数字和英文字母,建议采用英文缩写.</font></td>      
          </tr>      
          <tr>       
            <td align=right height=18 width="14%">密码:</td>      
            <td height=18 width="86%">       
              <input type="password" name=txtPass maxLength=10 size=15>      
              <font color=#ff0000>*</font><font color="#000000"><span class=tips_reg style="FONT-SIZE: 9pt">1--10 字符,只允许数字和英文字母</span>.</font></td>      
          </tr>      
          <tr>       
            <td align=right height=18 width="14%">确认密码:</td>      
            <td height=18 width="86%">       
              <input type="Password" name=txtRepass maxLength=10 size=15>      
              <font color=#ff0000>*</font></td>      
          </tr>      
          <tr>       
            <td align=right height=18 width="14%">自设问题:</td>      
            <td height=18 width="86%">       
              <input name=txtQuestion maxLength=20 size=30 value="">      
              <font color=#ff0000>*</font><font color="#000000"><font color="#000000">在您忘记了密码,需要找回密码的时候,会问您这个问题。比如,这样的问题“我的生日是几月几日?”</font></font></td>      
          </tr>      
          <tr>       
            <td align=right height=18 width="14%">自设答案:</td>      
            <td height=18 width="86%">       
              <input name=txtAnswer maxLength=20 size=30 value="">      
              <font color=#ff0000>*<span class=tips_reg style="FONT-SIZE: 9pt"><font color="#000000">您的自设问题的答案。比如,您的答案是“六月三号”</font><font color="#000000">.请牢记您的答案.</font></span></font></td>      
          </tr>      
       <tr>       
            <td align=right height=18 width="14%">联系电话:</td>      
            <td height=18 width="86%">       
              <input name=txtTel maxLength=50 size=30>            </td>      
          </tr>      
          <tr>       
            <td align=right height=18 width="14%">传真号码:</td>      
            <td height=18 width="86%">       
              <input name=txtFax maxLength=50 size=30>            </td>      
          </tr>      
          <tr>       
            <td align=right height=18 width="14%">电子邮箱:</td>      
            <td height=18 width="86%">       
              <input name=txtEmail maxLength=50 size=30 value="">      
              <font color=#ff0000>*</font></td>      
          </tr>
          <tr>    
            <td align=right height=25 width="14%">国籍:</td>   
            <td height=25 width="86%">    
              <select name=txtProv size=1>   
                    <OPTION  VALUE="中国" selected>&nbsp;&nbsp;中国&nbsp;&nbsp;</option>
                    <OPTION  VALUE="美国">&nbsp;&nbsp;美国&nbsp;&nbsp;</option>
                    <OPTION  VALUE="英国">&nbsp;&nbsp;英国&nbsp;&nbsp;</option>
                    <OPTION  VALUE="法国">&nbsp;&nbsp;法国&nbsp;&nbsp;</option>
                    <OPTION  VALUE="德国">&nbsp;&nbsp;德国&nbsp;&nbsp;</option>
</select>
<font color=#ff0000>*</font></td>      
</tr>      
<tr>       
<td align=right height=18 width="14%">城市:</td>      
<td height=18 width="86%">       
 <input name=txtCity maxLength=20 size=15 >      
<font color=#ff0000>*</font></td>      
</tr>
<tr>       
<td align=right height=18 width="14%">邮政编码:</td>      
            <td height=18 width="86%">       
              <input name=txtPost maxLength=8 size=15 value="">      
              <font color=#ff0000>*</font></td>      
          </tr>      
          <tr>       
            <td align=right height=18 width="14%">详细地址:</td>      
            <td height=18 width="86%">       
              <input name=txtAddress maxLength=50 size=50 value="">      
              <font color=#ff0000>*</font></td>      
          </tr>      
          <tr>       
            <td align=right height=18 width="14%">简短描述:</td>      
            <td height=18 width="86%">       
              <textarea cols=49 name=txtDesc rows=8></textarea><font color=#ff0000>*</font>            </td>      
          </tr>      
          <tr>       
            <td align=right height=18 width="14%"></td>      
            <td height=18   width="86%">       
              <input name="cmdOK" type="button" value=提交资料>&nbsp;&nbsp;&nbsp;&nbsp;<input name="cmdReset" type="reset" value=重置资料>            </td>      
          </tr>      
          </tbody>       
        </table>      
      </form>    </td>      
  </tr>      
</table>      
    
</body>      
</html>      
   
<SCRIPT language=VBScript>   
sub cmdOK_OnClick
if frmRegister.txtId.value="" then   
alert "提示: 请输入会员代码!"   
frmRegister.txtId.focus    
else   
if frmRegister.txtPass.value="" then   
alert "提示: 请输入密码!"   
frmRegister.txtPass.focus    
else   
if frmRegister.txtRepass.value<>frmRegister.txtPass.value then   
alert "提示: 两次密码不相符,请重新确认密码!"   
frmRegister.txtRepass.focus    
else   
if frmRegister.txtQuestion.value="" then   
alert "提示: 请设置问题,以便以后提取密码!"   
frmRegister.txtQuestion.focus    
else   
if frmRegister.txtAnswer.value="" then   
alert "提示: 请设置答案,以便以后提取密码!"   
frmRegister.txtAnswer.focus    
else   
if frmRegister.txtEmail.value="" then   
alert "提示: 请输入你的联系邮箱!"   
frmRegister.txtEmail.focus    
else   
if instr(1,frmRegister.txtEmail.value,"@")<2 then   
alert "提示; 你的联系邮箱不对!"   
frmRegister.txtEmail.focus    
else   
if trim(mid(frmRegister.txtEmail.value,instr(1,frmRegister.txtEmail.value,"@")+1,1))="" or trim(mid(frmRegister.txtEmail.value,instr(1,frmRegister.txtEmail.value,"@")+1,1))="." then   
alert "提示: 你的联系邮箱不对!"   
frmRegister.txtEmail.focus    
else   
if frmRegister.txtCity.value="" then   
alert "请输入你所在城市"   
frmRegister.txtCity.focus    
else   
if frmRegister.txtPost.value="" then   
alert "提示: 输入邮政编码!"   
frmRegister.txtPost.focus    
else   
if frmRegister.txtAddress.value="" then   
alert "提示: 请输入你的详细地址!"   
frmRegister.txtAddress.focus    
else   
if frmRegister.txtDesc.value="" then   
alert "提示: 请简单介绍你公司情况!"   
frmRegister.txtDesc.focus    
else   
if confirm("确定提交你的资料吗?") then   
call frmRegister.submit()   
end if   
end if   
end if   
end if   
end if   
end if   
end if   
end if   
end if   
end if   
end if   
end if   
end if   
end sub   
</SCRIPT>   
   
   
第二页:

<!--#include file="conn.asp"-->
<!--#include file="char.asp"-->
<%
    UserId=trim(request("txtId"))
    set rsUser=server.createobject("adodb.recordset")
    sqltext="select * from Userinfo where txtId='"&UserId&"'order by id desc"
    rsUser.open sqltext,conn,3,3
    if rsUser.recordcount>0 then
        response.write "<script language=JavaScript>{window.alert('此会员帐号已经注册!');window.history.go(-1)}</script>"
        response.end
    else
    '添加一条记录到数据库
        rsUser.addnew
        '必添项
        rsUser("txtClass")=Request("txtClass")
        rsUser("txtId")=Request("txtId")
        rsUser("txtPass")=Request("txtPass")
        rsUser("txtQuestion")=Request("txtQuestion")
        rsUser("txtAnswer")=Request("txtAnswer")
        rsUser("txtCat")=Request("txtCat")
        rsUser("txtCompany")=Request("txtCompany")
        rsUser("txtContect")=Request("txtContect")
        rsUser("txtTel")=Request("txtTel")
        rsUser("txtFax")=Request("txtFax")
        rsUser("txtEmail")=Request("txtEmail")
        rsUser("txtProv")=Request("txtProv")
        rsUser("txtCity")=Request("txtCity")
        rsUser("txtPost")=Request("txtPost")
        rsUser("txtAddress")=Request("txtAddress")
        rsUser("txtDesc")=htmlencode(Request("txtDesc"))
        rsUser("dateandtime")=now()
        rsUser("flag")=0
        
        If Request("txtUrl")="" Then
            rsUser("txtUrl")="未知"
        Else
            rsUser("txtUrl")=trim(Request("txtUrl"))
        End If
        
        If Request("txtTel")="" Then
            rsUser("txtTel")="未知"
        Else
            rsUser("txtTel")=trim(Request("txtTel"))
        End If
        
        If Request("txtFax")="" Then
            rsUser("txtFax")="未知"
        Else
            rsUser("txtFax")=trim(Request("txtFax"))
        End If

        rsUser.update
rsUser.close
conn.close
response.write "<script language=JavaScript>{window.alert('注册成功!请等待管理员为您开通账号!');window.location.href='register_4.html'}</script>"
        response.end
    end if
%>

回复列表 (共3个回复)

沙发

最烦看这样的帖子,没办法,太多,看得头疼,有需要把主要的句子贴出来,或者什么错误语句贴下就ok了!

板凳

看得头疼

3 楼


就是,把主要语句贴上来就行了,这么长,光看就得好一会!

我来回复

您尚未登录,请登录后再回复。点此登录或注册