注册 登录
编程论坛 ASP技术论坛

提交信息受限

lqd0523 发布于 2014-09-24 20:17, 1742 次点击
我在文本框中输入10个汉字,提交信息正常,超过10个汉字,页面显示:页面无法访问,我们有做任何限制,请大家帮我参考,求救。
一、添加信息页面代码
<html>
<head>
<title>cccc</title>
<style>
#footer
{
        bottom:0;
    display:block;
    height:23px;
    line-height:23px;
    width:950px;
    z-index:100;
    position:fixed !important;
    >position:absolute;
    margin:0 auto;
}

</style>
</head>
<body  topmargin="100">
<p align="center" ><font color=red>添加新信息</font></p>
<form name="bd" method="post" action="admin_add_ok.asp">
<table width="80%" border="0" cellpadding="0" cellspacing="" align="center" v>
<tr>
<td width="25%"  align="right" valign="middle" ><font color=red>*</font>编号:</td>
<td width="25%"  align="left" valign="middle"><input type="text" name="yh" ></td>
<td width="25%" align="right" valign="middle" ><font color=red>*</font>日期:</td>
<td  width="25%" align="left" valign="middle"><input type="text" name="xm" ></td></tr>


<tr>
<td width="25%"  align="right" valign="middle" ><font color=red>*</font>来源:</td>
<td width="25%"  align="left" valign="middle"><input type="text" name="xb" ></td>
<td width="25%" align="right" valign="middle" ><font color=red>*</font>内容:</td>
<td  width="25%" align="left" valign="middle"><input type="text" name="zy" ></td></tr>



<tr>
<td width="25%"  align="right" valign="middle" ><font color=red>*</font>基本信息:</td>
<td width="25%"  align="left" valign="middle"><input type="text" name="ssn" ></td>
<td width="25%" align="right" valign="middle" ><font color=red>*</font>结果:</td>
<td  width="25%" align="left" valign="middle"><input type="text" name="ssm" ></td></tr


><tr>
<td width="25%"  align="right" valign="middle" >备注:</td>
<td width="25%"  align="left" valign="middle"><input type="text" name="mn" ></td>
</tr>






<tr><td align="right" colspan="2"><input type="SUBMIT" name="tj" value="添加"></td>
<td align="left" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="Reset" name="qx" value="重置">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" name="cx" value="返回" onClick="window.location='admin.asp';"></td></tr>
</table
>
</form>
</body>
</html>
二、表单提交代码
<!-- #include file="../include/conn.asp" -->
<%response.buffer=true%>

<%
dim yh,xm,xb,zy,ssn,ssm,mn
yh=request("yh")
xm=request("xm")
xb=request("xb")
zy=request("zy")
ssn=request("ssn")
ssm=request("ssm")
mn=request("mn")

if yh="" then
    response.write "<script LANGUAGE='javascript'>alert('*不能为空!');history.go(-1);</script>"
    end if
    if xm="" then
    response.write "<script LANGUAGE='javascript'>alert('*不能为空!');history.go(-1);</script>"
    end if
    if xb="" then
    response.write "<script LANGUAGE='javascript'>alert('*不能为空!');history.go(-1);</script>"
    end if
    if zy="" then
    response.write "<script LANGUAGE='javascript'>alert('*不能为空!');history.go(-1);</script>"
    end if
    if ssn="" then
    response.write "<script LANGUAGE='javascript'>alert('*不能为空!');history.go(-1);</script>"
    end if
    if ssm="" then
    response.write "<script LANGUAGE='javascript'>alert('*不能为空!');history.go(-1);</script>"
    end if
   
   
   
str="select * from info  where username='"&yh&"'"

set rs=server.CreateObject("adodb.recordset")

rs.Open str,conn,1,1

if rs.recordcount>0 then
   
    response.Write "<script LANGUAGE='javascript'>alert('对不起您所输入的案件编号已存在!');history.go(-1);</script>"
    rs.close
    set rs=nothing
    response.end
else

    str1="select * from info"
    set rs=server.CreateObject("adodb.recordset")
rs.open str1,conn,1,3
rs.addnew
rs("username")=trim(yh)
rs("name")=trim(xm)
rs("sex")=trim(xb)
rs("zhuanye")=trim(zy)
rs("sushenumber")=trim(ssn)
rs("sushephone")=trim(ssm)
rs("moible")=trim(mn)
rs.update
rs.close
set rs=nothing
response.write "<script language=javascript>alert('添加信信息成功!');location.href=('admin.asp');</script>"
response.end
end if
%>
1 回复
#2
kingfangden2014-09-27 07:56
数据库字段文本设为备注。
1