asp 怎样改提交表单前进行数据验证 高手帮忙
请问高手下面的代码怎么改能实现表单提交前验证用户名与序列号同数据库中的tblgsm表的gsm段相符。相符后才能提交表单,不相符给出错误提示。谢谢<!--#includef...
请问高手下面的代码怎么改能实现表单提交前验证用户名与序列号同数据库中的tblgsm表的gsm段相符。相符后才能提交表单,不相符给出错误提示。谢谢
<!-- #include file="common.asp" -->
</HEAD>
<%
If Request("action") = "savenew" Then
Set Rs1 = Server.CreateObject("Adodb.Recordset")
strSql = "Select * from tblSell where (id is null)"
Rs1.Open StrSql, Conn, 3, 3
Rs1.AddNew
Rs1("Gsm1") = Request("Gsm1")
Rs1("GsmName1") = Request("GsmName1")&Request("GsmName2")&Request("GsmName3")&Request("GsmName4")
Rs1("FirstName") = Request("FirstName")
Rs1("Phone") = Request("Phone")
Rs1.Update
Rs1.Close
Call OutScriptLoc("alert('您的资料已经成功提交.')","jszx.asp")
Response.End
End If
%>
<BODY topmargin=0 >
<table width="100%" border="0" cellpadding="0" cellspacing="2" class="pt9">
<form name="form" action="?action=savenew" method="post" onSubmit="return check();">
<tr>
<td width="100%" valign="top"><table width="86%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#00ccff" class="pt9">
<tr bgcolor="#FFFFFF">
<td width="18%" align="right" height="32">用户名:</td>
<td width="82%" height="32"><input name="Gsm1" type="text" class="input1" size="15" maxlength="11" >
<font color="#FF0000">*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="26" align="right">序列号:</td>
<td><input name="GsmName1" type="text" class="input1" size="5" maxlength="5">
<font color="#FF0000">-</font><font color="#FF0000">
<input name="GsmName2" type="text" class="input1" size="5" maxlength="5">
-
<input name="GsmName3" type="text" class="input1" size="5" maxlength="5">
-
<input name="GsmName4" type="text" class="input1" size="5" maxlength="5">
*<br>
</font></td>
</tr>
<tr align="left" bgcolor="#FFFFFF">
<td colspan="2" class="note">资料</td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right">用户姓名:</td>
<td><input name="FirstName" type="text" class="input1" size="20"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right">电话:</td>
<td><input name="Phone" type="text" class="input1" size="30" maxlength="18">
<input class="botton1" type="submit" onClick="return btnSubmit_onclick1()" name="Submit" value="确定">
<input class="botton1" type="reset" name="reset" value="重填"></td>
</tr>
</table></td>
</tr>
</form>
</table>
</BODY></HTML>
如果是提交后认证改怎么改呢? 其实我就是一个数据对比的问题 提交前提交后没什么 只要能实现我描述的功能就可以了 展开
<!-- #include file="common.asp" -->
</HEAD>
<%
If Request("action") = "savenew" Then
Set Rs1 = Server.CreateObject("Adodb.Recordset")
strSql = "Select * from tblSell where (id is null)"
Rs1.Open StrSql, Conn, 3, 3
Rs1.AddNew
Rs1("Gsm1") = Request("Gsm1")
Rs1("GsmName1") = Request("GsmName1")&Request("GsmName2")&Request("GsmName3")&Request("GsmName4")
Rs1("FirstName") = Request("FirstName")
Rs1("Phone") = Request("Phone")
Rs1.Update
Rs1.Close
Call OutScriptLoc("alert('您的资料已经成功提交.')","jszx.asp")
Response.End
End If
%>
<BODY topmargin=0 >
<table width="100%" border="0" cellpadding="0" cellspacing="2" class="pt9">
<form name="form" action="?action=savenew" method="post" onSubmit="return check();">
<tr>
<td width="100%" valign="top"><table width="86%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#00ccff" class="pt9">
<tr bgcolor="#FFFFFF">
<td width="18%" align="right" height="32">用户名:</td>
<td width="82%" height="32"><input name="Gsm1" type="text" class="input1" size="15" maxlength="11" >
<font color="#FF0000">*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="26" align="right">序列号:</td>
<td><input name="GsmName1" type="text" class="input1" size="5" maxlength="5">
<font color="#FF0000">-</font><font color="#FF0000">
<input name="GsmName2" type="text" class="input1" size="5" maxlength="5">
-
<input name="GsmName3" type="text" class="input1" size="5" maxlength="5">
-
<input name="GsmName4" type="text" class="input1" size="5" maxlength="5">
*<br>
</font></td>
</tr>
<tr align="left" bgcolor="#FFFFFF">
<td colspan="2" class="note">资料</td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right">用户姓名:</td>
<td><input name="FirstName" type="text" class="input1" size="20"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right">电话:</td>
<td><input name="Phone" type="text" class="input1" size="30" maxlength="18">
<input class="botton1" type="submit" onClick="return btnSubmit_onclick1()" name="Submit" value="确定">
<input class="botton1" type="reset" name="reset" value="重填"></td>
</tr>
</table></td>
</tr>
</form>
</table>
</BODY></HTML>
如果是提交后认证改怎么改呢? 其实我就是一个数据对比的问题 提交前提交后没什么 只要能实现我描述的功能就可以了 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询