|
作者: bailove [bailove] 论坛用户 | 登录 |
还有一个很短的代码 帮忙看下. 问题是提交一次.数据库被添加了两次.相关的文件http://menhoo.com.cn/member.rar 里面有conn.asp和数据库. 帮我看下我数据库里面的表弄的有问题吗? 下面的代码我真看不出错了 <!--#include file="Conn.asp"--> <!--#include file="membermenu.asp"--> <!-- #include file="../admin/char.asp"--> <!--#include file="error.asp"--> <!--#include file="error1.asp"--> <% dim founderr,errmsg,sessionvar,userid founderr=false errmsg="" sessionvar="ok" userid=session("userid") if session("userlogin")<>sessionvar then founderr=true errmsg=errmsg+"<br>"+"你尚未登录,或者超时了!请重新登录!" call diserror1() response.end else if request.form("MM_insert") then if request.form("action")="add" then sql="select * from haved" set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,3 rs.addnew dim oil,money,color,transfer,birthyear,journey,foruse,kdqx,pic,pic1,pic2,pic3,meno,paizhao,phone,post,sf,flag,address,change,city,company,email,mobile dim fax,name,sip,stype,brand,cartype cartype=trim(request.form("cartype")) brand=trim(replace(request.form("brand"),"'","")) paizhao=trim(replace(request.form("paizhao"),"'","")) stype=trim(replace(request.form("type"),"'","")) oil=trim(replace(request.form("oil"),"'","")) money=cint(request.form("money")) color=trim(replace(request.form("color"),"'","")) transfer=trim(replace(request.form("transfer"),"'","")) birthyear=trim(replace(request.form("birthyear"),"'","")) journey=trim(replace(request.form("journey"),"'","")) foruse=trim(replace(request.form("foruse"),"'","")) kdqx=trim(replace(request.form("kdqx"),"'","")) pic=trim(replace(request.form("pic"),"'","")) pic1=trim(replace(request.form("pic1"),"'","")) pic2=trim(replace(request.form("pic2"),"'","")) pic3=trim(replace(request.form("pic3"),"'","")) meno=trim(replace(request.form("meno"),"'","")) phone=trim(replace(request.form("phone"),"'","")) post=trim(replace(request.form("post"),"'","")) phone=trim(replace(request.form("phone"),"'","")) sf=trim(replace(request.form("province"),"'","")) flag=trim(replace(request.form("flag"),"'","")) address=trim(replace(request.form("address"),"'","")) change=trim(replace(request.form("change"),"'","")) city=trim(replace(request.form("city"),"'","")) company=trim(replace(request.form("company"),"'","")) email=trim(replace(request.form("email"),"'","")) fax=trim(replace(request.form("fax"),"'","")) name=trim(replace(request.form("username"),"'","")) mobile=trim(replace(request.form("mobile"),"'","")) sip=Request.ServerVariables("REMOTE_ADDR") If sip="" Then sip=request.ServerVariables("HTTP_X_FORWARDED_FOR") End If if cartype="" then founderr=true errmsg=errmsg+"<br>"+"<li>你必须汽车分类!" else rs("cartype")=cartype end if if brand="" then founderr=true errmsg=errmsg+"<br>"+"<li>你必须填写汽车品牌!" else rs("brand")=brand end if rs("paizhao")=paizhao if stype="" then founderr=true errmsg=errmsg+"<br>"+"<li>你必须选择汽车型号!" else rs("type")=stype end if rs("oil")=oil if money="" then founderr=true errmsg=errmsg+"<br>"+"<li>你必须填写交易价格!" else rs("money")=money end if if color="" then founderr=true errmsg=errmsg+"<br>"+"<li>你必须填写汽车颜色!" else rs("color")=color end if rs("transfer")=transfer rs("birthyear")=birthyear if journey="" then founderr=true errmsg=errmsg+"<br>"+"<li>你必须填写行驶公里!" else rs("journey")=journey end if if foruse="" then founderr=true errmsg=errmsg+"<br>"+"<li>你必须选择车用途!" else rs("foruse")=foruse end if if kdqx="" then founderr=true errmsg=errmsg+"<br>"+"<li>你必须选择刊登期限!" else rs("kdqx")=kdqx end if rs("pic")=pic rs("pic1")=pic1 rs("pic2")=pic2 rs("pic3")=pic3 if meno="" then founderr=true errmsg=errmsg+"<br>"+"<li>你必须填写汽车备注!" else rs("meno")=meno end if rs("phone")=phone rs("post")=post rs("sf")=sf rs("flag")=flag rs("address")=address rs("change")=change rs("city")=city rs("company")=company rs("email")=email rs("fax")=fax rs("name")=name rs("mobile")=mobile rs("userid")=userid rs("ip")=sip if founderr then call diserror() response.end else rs.update rs.close set rs=nothing end if response.write "<script language=JavaScript>{window.alert('添加成功!');window.location.href='chelist.asp?type="&change&"';}</script>" end if end if %> <HTML><HEAD><TITLE>东南车网――会员专区</TITLE> <META http-equiv=Content-Type content="text/html; charset=gb2312"> <LINK href="images/css.css" type=text/css rel=stylesheet> <SCRIPT language=JavaScript type=text/JavaScript> <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } //--> </SCRIPT> <SCRIPT language=javascript> function show_sader(mylink) { window.open(mylink,'','top=140,left=135,width=480,height=280,scrollbars=no ') } </SCRIPT> <META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD> <BODY> <SCRIPT language=JavaScript type=text/JavaScript> <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } //--> </SCRIPT> <SCRIPT language=javascript> function show_sader(mylink) { window.open(mylink,'','top=140,left=135,width=480,height=280,scrollbars=no ') } </SCRIPT> <SCRIPT language=JavaScript> function CheckInput() { if (document.Form1.cartype.value == "") { alert("汽车分类不能为空!"); document.Form1.cartype.focus(); return false; } if (document.Form1.brand.value == "") { alert("请输入汽车品牌!"); document.Form1.brand.focus(); return false; } if (document.Form1.type.value == "") { alert("请输入汽车型号!"); document.Form1.type.focus(); return false; } if (document.Form1.money.value == "") { alert("请输入汽车价格!"); document.Form1.money.focus(); return false; } if (document.Form1.meno.value == "") { alert("请输入汽车状况!"); document.Form1.meno.focus(); return false; } document.Form1.submit() } </SCRIPT> <div align="center"> <TABLE height=47 cellSpacing=0 cellPadding=0 width=770 border=0> <TBODY> <TR> <TD vAlign=bottom align=right background=images/line.gif height=44> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD width=300> </TD> <TD vAlign=bottom align=right width=460><A href="erro1.asp"> <IMG src="images/reset.gif" border=0></A> <A href="../asp/logincheck.asp?action=logout"> <IMG src="images/back.gif" border=0></A> </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE> </div> <div align="center"> <table border="0" width="80%" cellspacing="0" cellpadding="0"> <tr> <td width="189" valign="top"> <%call membermenu()%></td> <td> <table border="0" width="100%" cellspacing="0" cellpadding="0" height="100%" id="table1"> <tr> <td height="51"> <IMG height=36 src="images/hyzq_t.gif" width=109></td> </tr> <tr> <td valign="top"> <%sql="select * from [user] where userid='"&userid&"'" set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1%> <table border="1" width="100%" id="table2"> <tr> <td> <FORM name=Form1 method=POST> <TABLE height=280 cellSpacing=0 cellPadding=0 width="100%" borderColorLight=#ffffff border=0 id="table3"> <TBODY><INPUT type=hidden value=卖 name=change> <TR> <TD colSpan=4 height=17> <TABLE id=table4 style="BORDER-COLLAPSE: collapse" borderColor=#111111 cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD width=770 height=17> <TABLE id=table5 style="BORDER-COLLAPSE: collapse" borderColor=#111111 cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD width="84%"><SPAN style="FONT-SIZE: 10.5pt"><B> 汽车出售</B></SPAN></TD> <TD width="16%"> <P align=right><FONT color=#ff6600> *</FONT><FONT color=#000080>为必填项 </FONT></P></TD></TR></TBODY></TABLE> <TABLE id=table6 style="BORDER-COLLAPSE: collapse" borderColor=#111111 cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD align=right width="15%" height=10> </TD> <TD width="58%" height=10> </TD> <TD width="27%" height=10> </TD></TR></TBODY></TABLE> <TABLE id=table7 style="BORDER-COLLAPSE: collapse" borderColor=#111111 cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD background="" height=1></TD> <TD background=""></TD></TR></TBODY></TABLE> <TABLE id=table8 style="BORDER-COLLAPSE: collapse" borderColor=#111111 cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD align=right width="15%" height=10> </TD> <TD width="58%" height=10> </TD> <TD width="27%" height=10> </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR> <TR height=25> <TD align=right width=89 height=23><SPAN class=word9>汽车分类</SPAN>:</TD> <TD width=213 height=23><SELECT size=1 name=cartype> <OPTION value="" selected>全部车型</OPTION> <OPTION value=轿车>轿车</OPTION> <OPTION value=跑车>跑车</OPTION> <OPTION value=SUV及越野车>SUV及越野车</OPTION> <OPTION value=箱形车>箱形车</OPTION> <OPTION value=概念车>概念车</OPTION> <OPTION value=客车>客车</OPTION> <OPTION value=货车>货车</OPTION> <OPTION value=其它车型>其它车型</OPTION></SELECT> <FONT color=#ff6600>*</FONT></TD> <TD width=90 height=23> <P align=center><SPAN class=word9>汽车品牌:</SPAN></P></TD> <TD width=216 height=23><INPUT class=f11 title=例如:桑塔纳200、红旗CA7200、SVW7180CEI size=15 name=brand> <FONT color=#ff6600>*</FONT></TD></TR> <TR> <TD align=right width=89 height=24>现车牌照:</TD> <TD width=213 height=24><INPUT class=f11 title=例如:浙AT0385 size=15 name=paizhao> <FONT color=#ff6600>*</FONT></TD> <TD align=middle width=90 height=24><SPAN class=word9>汽车型号:</SPAN></TD> <TD width=216 height=24><INPUT class=f11 title=例如:桑塔纳200、红旗CA7200、SVW7180CEI size=15 name=type> <FONT color=#ff6600>*</FONT></TD></TR> <TR> <TD align=right width=89 height=25> 油耗量:</TD> <TD width=213 height=25><INPUT size=10 name=oil> c.c.</TD> <TD align=middle width=90 height=24> <SPAN class=word9>交易价格:</SPAN></TD> <TD width=216 height=24><INPUT class=f11 title=车价以人民币(元)为单位(填0表示面议) size=12 name=money> 元 <FONT color=#ff6600>*</FONT>(<span lang="zh-cn">只能填数字,填0为"价格面议")</span></TD></TR> <TR> <TD align=right width=89 height=21><SPAN class=word9>汽车颜色:</SPAN></TD> <TD width=213 height=21><SELECT style="FONT-SIZE: 13px" size=1 name=color> <OPTION selected>请选择</OPTION> <OPTION value=白色>白色</OPTION> <OPTION value=银色>银色</OPTION> <OPTION value=绿色>绿色</OPTION> <OPTION value=红色>红色</OPTION> <OPTION value=黄色>黄色</OPTION> <OPTION value=蓝色>蓝色</OPTION> <OPTION value=黑色>黑色</OPTION> <OPTION value=紫色>紫色</OPTION> <OPTION value=棕色>棕色</OPTION> <OPTION value=其他>其他</OPTION></SELECT> <FONT color=#ff6600>*</FONT></TD> <TD align=middle width=90 height=21>车牌过户:</TD> <TD width=216 height=21> <SPAN class=word9> <INPUT title=指牌照是否过户 type=radio CHECKED value=能 name=transfer> </SPAN>是<SPAN class=word9> <INPUT title=指牌照是否过户 type=radio value=目前不能 name=transfer> 否</SPAN> </TD></TR> <TR> <TD align=right width=89 height=25>购买日期:</TD> <TD width=213 height=25> <!--webbot bot="Validation" s-data-type="String" b-value-required="TRUE" i-maximum-length="10" --><INPUT title=请输入年份 maxLength=10 size=10 name=birthyear> 年 <FONT color=#ff6600>*</FONT>(<span lang="zh-cn">格式如:1982-02-21)</span></TD> <TD align=middle width=90 height=25><SPAN class=word9>行驶公里:</SPAN></TD> <TD width=216 height=25><INPUT title=已经行驶多少公里 size=12 name=journey> 公里<FONT color=#ff6600> *</FONT></TD></TR> <TR> <TD align=right width=89 height=1>原车用途:</TD> <TD width=213 height=1><SELECT name=foruse> <OPTION selected>--请选择--</OPTION> <OPTION value=私人用车>私人用车</OPTION> <OPTION value=出租车>出租车</OPTION> <OPTION value=租赁车>租赁车</OPTION> <OPTION value=机关用车>机关用车</OPTION> <OPTION value=公务用车>公务用车</OPTION> <OPTION value=运输用车>运输用车</OPTION> <OPTION value=地方车辆>地方车辆</OPTION> <OPTION value=驾校教练车>驾校教练车</OPTION> <OPTION value=外地迁京车辆>外地迁京车辆</OPTION> <OPTION value=其它>其它</OPTION></SELECT> <FONT color=#ff6600>*</FONT></TD> </TR> <TR> <TD align=right width=89 height=12> 刊登期限:</TD> <TD width=213 height=12><SELECT class=f11 style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid" size=1 name=kdqx> <OPTION value=一周 selected>一周</OPTION> <OPTION value=半月>半月</OPTION> <OPTION value=一个月>一个月</OPTION> <OPTION value=三个月>三个月</OPTION> <OPTION value=六个月>六个月</OPTION> <OPTION value=一年>一年</OPTION> <OPTION value=长期>长期</OPTION></SELECT> <FONT color=#ff6600>*</FONT></TD> <TD align=middle width=90 height=12> </TD> <TD width=216 height=12> </TD></TR> <TR> <TD align=right width=89 height=12></TD> <TD width=213 height=12></TD> <TD align=middle width=90 height=12> </TD> <TD width=216 height=12> </TD></TR> <TR> <TD align=right width=89 height=1>汽车图片1:</TD> <TD colSpan=3 height=1> <INPUT title=已经行驶多少公里 size=52 name=pic><FONT color=#ff6600> *</FONT></TD></TR> <TR> <TD align=right width=89 height=1>汽车图片2:</TD> <TD colSpan=3 height=1> <INPUT title=已经行驶多少公里 size=52 name=pic1><FONT color=#ff6600> *</FONT></TD></TR> <TR> <TD align=right width=89 height=1>汽车图片3:</TD> <TD colSpan=3 height=1> <INPUT title=已经行驶多少公里 size=52 name=pic2><FONT color=#ff6600> *</FONT></TD></TR> <TR> <TD align=right width=89 height=1>汽车图片4:</TD> <TD colSpan=3 height=1> <INPUT title=已经行驶多少公里 size=52 name=pic3><FONT color=#ff6600> *</FONT></TD></TR> <TR> <TD align=right width=89 height=57> 汽车备注:<BR> (最多500字)</TD> <TD align=left colSpan=3 height=57> <TEXTAREA class=f11 title=车况描述最多只能500个字 style="FONT-FAMILY: 宋体" name=meno rows=4 cols=46></TEXTAREA> <FONT color=#ff6600> *</FONT></TD></TR> <TR> <TD align=middle colSpan=4 height=21></TD></TR> <TR> <TD align=middle colSpan=4 height=21> <INPUT type=hidden value="<%=rs("address")%>" name=address> <INPUT type=hidden value="<%=rs("flag")%>" name=flag> <INPUT type=hidden value="<%=rs("company")%>" name=company> <INPUT type=hidden value="<%=rs("city")%>" name=city> <INPUT type=hidden value="<%=rs("sf")%>" name=province> <INPUT type=hidden value="<%=rs("phone")%>" name=phone> <INPUT type=hidden value="<%=rs("fax")%>" name=fax> <INPUT type=hidden value="<%=rs("post")%>" name=post> <INPUT type=hidden value="<%=rs("email")%>" name=email> <INPUT type=hidden value="<%=rs("name")%>" name=username> <INPUT onclick=CheckInput() type=submit value=提交 name=button> <INPUT type=reset value=取消 name=Submit3> </TD></TR> <TR height=25> <TD align=middle colSpan=4 height=12></TD></TR></TBODY></TABLE> <input type="hidden" name="MM_insert" value="true"> <input type="hidden" name="action" value="add"> <input type="hidden" name="mobile" value="<%=rs("mobile")%>"></FORM> </td> </tr> <tr> <td> <p align="center"><font color="#FF0000"> 使用方法:将下面上传的图片地址复制到上面的图片地址栏中</font></td> </tr> <tr> <td> <iframe name="I1" src="upload.asp" scrolling="no" width="557" height="53"> 浏览器不支持嵌入式框架,或被配置为不显示嵌入式框架。</iframe></td> </tr> </table> <%end if%> |
地主 发表时间: 04-08-07 10:00 |
回复: bailove [bailove] 论坛用户 | 登录 |
中间那些input可以不用看啊.所以说很短的代码!!!放到编辑器中就很明朗了 |
B1层 发表时间: 04-08-07 10:04 |
回复: bailove [bailove] 论坛用户 | 登录 |
终于找出了问题 代码中 <INPUT onclick=CheckInput() type=submit value=提交 name=button> <INPUT type=reset value=取消 name=Submit3> </TD></TR> <TR height=25> <TD align=middle colSpan=4 height=12></TD></TR></TBODY></TABLE> onclick=CheckInput() 检查表单的结果是就已经 提交了一遍 至于为什么? 我给自己的理由并不充分? 谁有更好的解释阿 |
B2层 发表时间: 04-08-08 00:22 |
回复: zmdxl [zmdxl] 论坛用户 | 登录 |
你把 <INPUT onclick=CheckInput() type=submit value=提交 name=button> 改成 <INPUT onclick=CheckInput() type=button value=提交 name=button> 就可以了 |
B3层 发表时间: 04-08-23 23:13 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号