| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 403 人关注过本帖
标题:asp向数据库提交表单
只看楼主 加入收藏
stone0212
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2011-8-1
结帖率:33.33%
收藏
 问题点数:0 回复次数:0 
asp向数据库提交表单
请高手帮帮忙,我是asp初学者,一个向数据库提交表单的程序把我难住了,呜呜呜。。。下面详细说一下,点击提交时,没报错,但就是数据库没反应。看看我的哪错了,如果能给个处理程序的代码就最好了,不胜感激。
表单网页:
<!--#include file="config.asp" -->
<html>
<title><%=title_name%></title>
<SCRIPT language=javascript>
function check_input()  
{  
    if (Frm.name.value=="")
    {   alert("姓名不能为空,请重新填写!");
        return false;
    }
    if (Frm.sfzh.value=="")
    {   alert("身份证号不能为空,请重新填写!");
        return false;
    }
    if (Frm.sex.value=="")
    {   alert("性别不能为空,请重新填写!");
        return false;
    }
    if (Frm.minzu.value=="")
    {   alert("民族不能为空,请重新填写!");
        return false;
    }
    if (Frm.name.value=="")
    {   alert("姓名不能为空,请重新填写!");
        return false;
    }
    if (Frm.whcd.value=="")
    {   alert("文化程度不能为空,请重新填写!");
        return false;
    }
    if (Frm.gzsj.value=="")
    {   alert("参加工作时间不能为空,请重新填写!");
        return false;
    }
    if (Frm.zhiye.value=="")
    {   alert("职业类别不能为空,请重新填写!");
        return false;
    }
    if (Frm.leixing1.value=="")
    {   alert("学校及专业不能为空,请重新填写!");
        return false;
    }
    if (Frm.age.value=="" )
    {   alert("出生年月不能为空,请重新填写!");
        return false;
    }
        if (Frm.yzbm.value=="")
    {   alert("邮政编码不能为空,请重新填写!");
        return false;
    }
        if (Frm.address.value=="")
    {   alert("通讯地址不能为空,请重新填写!");
        return false;
    }
    if (Frm.phone.value=="")
    {   alert("家庭联系电话不能为空,请重新填写!");
        return false;
    }
    if (Frm.yddh.value=="")
    {   alert("本人电话不能为空,请重新填写!");
        return false;
    }
    return true;
}
</SCRIPT>
<style type="text/css"></style>
<LINK href="style.css" type=text/css rel=stylesheet>
<style fprolloverstyle>
A:hover {color: #FF0000}
.qq {
    font-family: "黑体";
    font-size: 24px;
    font-weight: bold;
    color: #FF0000;
}
.style1 {font-size: 24px; font-weight: bold; font-family: "黑体";}
.style2 {color: #000003}
.style3 {color: #FF0000}
.style5 {color: #FF0000; font-size: 12pt; }
.style6 {font-size: 9pt}
.style7 {font-size: 12pt}
</style>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" link="#C0C0C0">

<div align="center">
  <center>
    <table width="778" border="1" cellspacing="8" cellpadding="0" style="border-collapse:collapse" height="672">
      <tr>
        <td width="778" height="654" valign="middle" background="bg.gif" bgcolor="#FFFFFF" class="p11">
          <p align="center">&nbsp;</p>
          <p align="center"><font color="#FF0000" size="5" face="黑体">报名表</font></p>
          <hr> <p align="center">&nbsp;</p>
          <form action=saveinfo.asp method=post name=Frm onSubmit="return check_input()">
            <p class="p9"><span style="font-size: 9pt">姓  名: </span>
              <input name="name" type="text" id="name2" style="border:1px dotted #585858;font-style:normal; font-variant:normal; font-weight:normal; font-size:9pt" size="20">
              <span style="font-size: 9pt"> <font color="#999999">   </font>出生日期<font color="#999999"><span style="font-size: 9pt">:
              </span> <span style="font-size: 9pt">
              <input name="age" type="text" id="age" style="border:1px dotted #585858;font-style:normal; font-variant:normal; font-weight:normal; font-size:9pt">
                </span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span style="font-size: 9pt">性  别:
              <select name="sex" id="sex" style="border-style: dotted; border-width: 1">
                <option value="A1"><%=sex_1%></option>
                <option value="A2"><%=sex_2%></option>
              </select>
                    </span></p>
            <p class="p9"><span style="font-size: 9pt">民  族: </span><span style="font-size: 9pt">
               <span style="font-size: 9pt">
              <input name="minzu" type="text" id="minzu" size="12" style="border-style: dotted; border-width: 1">
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt">政 治 面 貌:
              </span><span style="font-size: 9pt">  <span style="font-size: 9pt">
              <span style="font-size: 9pt"><span style="font-size: 9pt">
              <input name="zzmm" type="text" id="zzmm" size="12" style="border-style: dotted; border-width: 1">
              </span></span> </span>   文  化  程  度: </span> <span style="font-size: 9pt">
              <span style="font-size: 9pt">
              <input name="whcd" type="text" id="whcd" size="8" style="border-style: dotted; border-width: 1">
              </span>  </span></p>
            <p class="p9"><span style="font-size: 9pt">身份证号: </span> <span style="font-size: 9pt">
              <span style="font-size: 9pt">
              <input name="sfzh" type="text" id="sfzh" size="30" style="border-style: dotted; border-width: 1">
              </span>  毕业院校:
              <input name="byyx" type="text" id="byyx" size="25" style="border:1px dotted #585858;font-style:normal; font-variant:normal; font-weight:normal; font-size:9pt">
              &nbsp;&nbsp;&nbsp;所学专业:
              <input name="zhuanye" type="text" id="zhuanye" size="20" style="border:1px dotted #585858;font-style:normal; font-variant:normal; font-weight:normal; font-size:9pt">
              </span></p>
            <p class="p9"><span style="font-size: 9pt">参加<span style="font-size: 9pt">工作时间:
              </span> <span style="font-size: 9pt"> <span style="font-size: 9pt">
              <input name="gzsj" type="text" id="gzsj" size="10" style="border-style: dotted; border-width: 1">
              </span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style="font-size: 9pt">职业类别</span><span style="font-size: 9pt">:
              <input name="zhiye" type="text" id="zhiye" size="20" style="border-style: dotted; border-width: 1">
              </span> <span style="font-size: 9pt">    <span style="font-size: 9pt">邮政编码:
              </span> <span style="font-size: 9pt"> <span style="font-size: 9pt">
              <input name="yzbm" type="text" id="yzbm" size="10" style="border-style: dotted; border-width: 1">
              </span> </span> </span></p>
            <p class="p9"><span style="font-size: 9pt">工作单位或有效的通讯地址: </span>
              <input type="text" name="address" size="44" style="border:1px dotted #585858;font-style:normal; font-variant:normal; font-weight:normal; font-size:9pt">
              <span style="font-size: 9pt"> <font color="#999999"> </font></span><span style="font-size: 9pt">&nbsp;&nbsp;&nbsp;&nbsp;本人联系电话(手机):
              </span> <span style="font-size: 9pt"> <span style="font-size: 9pt">
              <input name="yddh" type="text" id="yddh2" size="15" style="border-style: dotted; border-width: 1">
              </span></span></p>
            <p class="p9"><span style="font-size: 9pt">家庭地址: </span> <span style="font-size: 9pt">
              <span style="font-size: 9pt">
              <input name="jtdz" type="text" id="tzs2" size="50" style="border-style: dotted; border-width: 1">
              </span> </span></p>
            <p class="p9"><span style="font-size: 9pt">家庭联系电话(写明区号): </span>
              <input type="text" name="phone" style="border:1px dotted #585858;font-style:normal; font-variant:normal; font-weight:normal; font-size:9pt" size="20">
              <span style="font-size: 9pt">  </span><span style="font-size: 9pt"><br>
              <br>
              第一志愿报考学校及专业: </span>
              <select name="leixing1" id="leixing1" style="border-style: dotted; border-width: 1">
                <option value="A1"><%=title_1%></option>
                <option value="A2"><%=title_2%></option>
                <option value="A3"><%=title_3%></option>
                <option value="A9"><%=title_9%></option>
                <option value="A6"><%=title_6%></option>
                <option value="A7"><%=title_7%></option>
                <option value="A8"><%=title_8%></option>
                <option value="A10"><%=title_10%></option>
                <option value="A4"><%=title_4%></option>
                <option value="A5"><%=title_5%></option>
                <option value="A13"><%=title_13%></option>
                <option value="A14"><%=title_14%></option>
                <option value="A15"><%=title_15%></option>
                <option value="A16"><%=title_16%></option>
                <option value="A18"><%=title_18%></option>
                <option value="A17"><%=title_17%></option>
                <option value="A20"><%=title_20%></option>
                <option value="A22"><%=title_22%></option>
                <option value="A21"><%=title_21%></option>
                <option value="A19"><%=title_19%></option>
                <option value="A39"><%=title_39%></option>
                <option value="A40"><%=title_40%></option>
                <option value="A41"><%=title_41%></option>
                <option value="A42"><%=title_42%></option>
                <option value="A43"><%=title_43%></option>
                <option value="A44"><%=title_44%></option>
                <option value="A45"><%=title_45%></option>
                <option value="A46"><%=title_46%></option>
                <option value="A47"><%=title_47%></option>
                <option value="A49"><%=title_49%></option>
                <option value="A50"><%=title_50%></option>
                <option value="A53"><%=title_53%></option>
                <option value="A54"><%=title_54%></option>
                <option value="A56"><%=title_56%></option>
                <option value="A57"><%=title_57%></option>
                <option value="A58"><%=title_58%></option>
                <option value="A59"><%=title_59%></option>
                <option value="A60"><%=title_60%></option>
                <option value="A61"><%=title_61%></option>
              </select>
              <span style="font-size: 9pt"> &nbsp;&nbsp;&nbsp;</span></p>
            <p class="p9">学习形式<span style="font-size: 9pt">:业余
              <input name="xxxs1" type="checkbox" id="xxxs1" value="业余">
              函授
              <input name="xxxs1" type="checkbox" id="xxxs1" value="函授">
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;学历层次:专升本
              <input name="xlcc" type="checkbox" id="xlcc" value="专升本">
              高起专
              <input name="xlcc" type="checkbox" id="xlcc" value="高起专">
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;应试外语语种:英语
              <input name="wyyz" type="checkbox" id="wyyz" value="yy">
              日语
              <input name="wyyz" type="checkbox" id="wyyz" value="ry">
              俄语
              <input name="wyyz" type="checkbox" id="wyyz" value="ey">
              </span></p>
            <p class="p9"><span style="font-size: 9pt">第二志愿报考学校及专业:
              <select name="leixing2" id="leixing2" style="border-style: dotted; border-width: 1">
                <option value="A1"><%=title_1%></option>
                <option value="A2"><%=title_2%></option>
                <option value="A3"><%=title_3%></option>
                <option value="A9"><%=title_9%></option>
                <option value="A6"><%=title_6%></option>
                <option value="A7"><%=title_7%></option>
                <option value="A8"><%=title_8%></option>
                <option value="A10"><%=title_10%></option>
                <option value="A4"><%=title_4%></option>
                <option value="A5"><%=title_5%></option>
                <option value="A13"><%=title_13%></option>
                <option value="A14"><%=title_14%></option>
                <option value="A15"><%=title_15%></option>
                <option value="A16"><%=title_16%></option>
                <option value="A18"><%=title_18%></option>
                <option value="A17"><%=title_17%></option>
                <option value="A20"><%=title_20%></option>
                <option value="A22"><%=title_22%></option>
                <option value="A21"><%=title_21%></option>
                <option value="A19"><%=title_19%></option>
                <option value="A39"><%=title_39%></option>
                <option value="A40"><%=title_40%></option>
                <option value="A41"><%=title_41%></option>
                <option value="A42"><%=title_42%></option>
                <option value="A43"><%=title_43%></option>
                <option value="A44"><%=title_44%></option>
                <option value="A45"><%=title_45%></option>
                <option value="A46"><%=title_46%></option>
                <option value="A47"><%=title_47%></option>
                <option value="A49"><%=title_49%></option>
                <option value="A50"><%=title_50%></option>
                <option value="A53"><%=title_53%></option>
                <option value="A54"><%=title_54%></option>
                <option value="A56"><%=title_56%></option>
                <option value="A57"><%=title_57%></option>
                <option value="A58"><%=title_58%></option>
                <option value="A59"><%=title_59%></option>
                <option value="A60"><%=title_60%></option>
                <option value="A61"><%=title_61%></option>
              </select>
              &nbsp;&nbsp;&nbsp;学习形式:业余
              <input name="xxxs2" type="checkbox" id="xxxs2" value="checkbox">
              函授
              <input name="xxxs2" type="checkbox" id="xxxs2" value="checkbox">
              <br>
              <br>
              </span><span style="font-size: 9pt"> </span><span style="font-size: 9pt">
              </span><span style="font-size: 9pt"><br>
              </span><span style="font-size: 9pt"><br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              </span>
              <input type="submit" name="Submit" value=" 提 交 信 息 " style="border-style:outset; border-width:1; font-style:normal; font-variant:normal; font-weight:normal; font-size:9pt">
              <span style="font-size: 9pt">    </span>
              <input type="reset" name="Reset" value=" 重 新 填 写 " style="border-style:outset; border-width:1; font-style:normal; font-variant:normal; font-weight:normal; font-size:9pt">
              <span style="font-size: 9pt">   &nbsp; <a style="text-decoration: none" href="login.htm">
              <font color="#666666">管理</font></a></span></p>
          </form></td>
      </tr>
    </table>


  </center>
</div>



  </html>


提交到数据库的网页saveinfo.asp
<!--#include file="conn.asp" -->
<!--#include file="config.asp" -->
<%

Set rs=Server.CreateObject( "ADODB.Recordset ")
rs.open  feedbackinfo,conn,adopenkeyset,adlockoptimistic,adcmdtext
set rs=getrecordset("websking.mdb","feedbackinfo")
rs.addnew
rs("name")=request("name")
rs("sex")=request("sex")
rs("minzu")=request("minzu")
rs("age")=request("age")
rs("zzmm")=request("zzmm")
rs("whcd")=request("whcd")
rs("sfzh")=request("sfzh")
rs("byyx")=request("byyx")
rs("zhuanye")=request("zhuanye")
rs("gzsj")=request("gzsj")
rs("zhiye")=request("zhiye")
rs("yzbm")=request("yzbm")
rs("address")=request("address")
rs("yddh")=request("yddh")
rs("jtdz")=request("jtdz")
rs("phone")=request("phone")
rs("leixing1")=request("leixing1")
rs("xxxs1")=request("xxxs1")
rs("xlcc")=request("xlcc")
rs("wyyz")=request("wyyz")
rs("leixing2")=request("leixing2")
rs("xxxs2")=request("xxxs2")
rs.update
rs.close                  
set conn=nothing
conn.close                 
set rs=nothing
%>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title><%=title_name%></title>
<LINK href="style.css" type=text/css rel=stylesheet>
</head>

<body class=noborder
style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px"
bgColor=#d4d0c8 leftMargin=0 topMargin=0 background="bg.gif" >
<table border=1 cellspacing=0 cellpadding=3 align="center" width="460" bordercolordark="#ffffff" bordercolorlight="#000000" bordercolor="#000000" height="25" >
  <tr>
    <td bordercolordark="#FFFFFF" width="450" height="23"> <font color="#CC0000" style="font-size: 9pt"><span class="p11">&nbsp;您的注册信息已经成功提交给我们,稍后我们将迅速处理您的信息并尽快作出答复!</span></font></td>
  </tr>
</table>
<table width="687" border="0" cellspacing="0" cellpadding="3" align="center">
  <tr  align="right">  
  <td colspan="2" height="30" valign="middle" align="right" width="681" >
  <p align="center"><span style="font-size: 9pt"><a href="index.asp">[返回表单]</a></span><a href="#" onclick="javascript:window.close();"><span style="font-size: 9pt">[关闭窗口]</span></a></td>
</tr>
</table>
</body>

</html>



数据库中的表中字段:id(自动编号类型),name,sex,minzu,age,zzmm,whcd,sfzh,byyx,zhuanye,gzsj,zhiye,yzbm,address,yddh,jtdz,phone,leixing1,xxxs1,xlcc,wyyz,leixing2,xxxs2
搜索更多相关主题的帖子: javascript function 不胜感激 include 身份证号 
2011-08-01 15:48
快速回复:asp向数据库提交表单
数据加载中...
 
   



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

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