| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 646 人关注过本帖
标题:表单修改后不能保存到数据库
取消只看楼主 加入收藏
shaoshanglai
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-4-2
收藏
 问题点数:0 回复次数:0 
表单修改后不能保存到数据库

我从网上下了一个会员管理系统.想自己改一下,但是发现我在表单里添加几个文本输入框或者改动一点点,表单就无法保存到数据库中.(可以填写,提交,但是数据库里没有刚提交的资料)!高手们帮我看看吧!谢谢了!

下面是两个页面的代码:

第一页:

<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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))=" 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

%>

2007-04-02 13:34
快速回复:表单修改后不能保存到数据库
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.030771 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved