| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 403 人关注过本帖
标题:[求助]表单提交页面显示不出来
只看楼主 加入收藏
lala2617
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-9-14
收藏
 问题点数:0 回复次数:0 
[求助]表单提交页面显示不出来

这个页面定义sendok=0 时显示表单 ,然后填完提交sendok=1 显示提交成功,可是点了提交出来错误页面。
<%@ Language=VBScript%>
<%
Response.Buffer=false
Response.Expires=0
%>
<!-- #include file="./dsnroot.asp" -->
<!-- #include file="./links.asp" -->
<%
set cn=Server.CreateObject("ADODB.Connection")
set rs=Server.CreateObject("ADODB.Recordset")
set rs1=Server.CreateObject("ADODB.Recordset")
cn.Open mycnstr
sendok=0
sendok=cint(Request.QueryString("sendok"))
bus=Request.QueryString("bus")
id=Request.QueryString("id")
menu="0000001"
if id="" then
id=0
else
id=cint(id)
end if
if bus="" then
bus=0
else
bus=cint(bus)
end if
if bus<>0 then
sqltext="select id,title from danwei where id="&bus&" and ppid=13 and enable=1"
rs.Open sqltext,cn,1,1
if not rs.EOF then
subject="关于"&trim(rs("title"))&"事宜"
end if
rs.Close
end if


if id=0 then
sqltext="select * from count where enable=1 order by pl"
rs.Open sqltext,cn,1,1
if not rs.EOF then
id=rs("id")
end if
rs.Close
end if

if id<>0 then
sqltext="select * from count where enable=1 and id="&id
rs.Open sqltext,cn,1,1
if not rs.EOF then
toname=rs("title")
toemail=rs("email")
totel=rs("tel")
tofax=rs("fax")
toadd=rs("add")
topostyb=rs("postyb")
end if
rs.Close
end if
if sendok=0 then
if Request.ServerVariables("REQUEST_METHOD") = "POST" and toemail<>"" then
sender = Request.Form("from")
subject = Request.Form("subject")
content=Request.Form("body")
name = Request.Form("name")
company = Request.Form("company")
address = Request.Form("address")
telphone = Request.Form("telphone")
fax = Request.Form("fax")
content=Request.Form("body")
sqltext="select * from contact"
rs.Open sqltext,cn,1,2
rs.AddNew
rs("title")=subject
rs("email")=sender
rs("name")=name
rs("toname")=toname
rs("compa")=company
rs("add")=address
rs("tel")=telphone
rs("fax")=fax
rs("body")=content
rs("toid")=checkrad
rs("creatdate")=now()
rs.Update
rs.Close
s_string="姓名:" & name & chr(13) & chr(10) & "时间:" & now() & chr(13) & chr(10) & "公司:" & company & chr(13) & chr(10) & "地址:" & address & chr(13) & chr(10) & "电话:" & telphone & chr(13) & chr(10) & "传真:" & fax & chr(13) & chr(10) & "信箱:" & sender

Set msg = Server.CreateObject("JMail.Message")
msg.silent = true
msg.Logging = true
msg.Charset = "gb2312"
msg.MailServerUserName = "chaiyun2617@163.com" '输入smtp服务器验证登陆名
msg.MailServerPassword = "19842617" '输入smtp服务器验证密码 (用户Email帐号对应的密码)
msg.From = "chaiyun2617@163.com" '发件人Email
msg.FromName = name '发件人姓名
msg.AddRecipientBCC "chaiyun2617@163.com" '密件传送'
msg.Subject = "飞鸟俱乐部网站留言:"+subject '信件主题
msg.Body = "主题:"&subject&chr(13)&chr(10)&s_string&chr(13)&chr(10)&content '正文
msg.AddRecipient toemail '收件人Email
msg.Send ("smtp.163.com") 'smtp服务器地址(企业邮局地址)
set msg = nothing
'set myobj=Server.CreateObject("cdonts.newmail")
'myobj.From=sender
'myobj.To=" "
'myobj.BodyFormat=0
'myobj.Subject="公众留言:"+subject
'myobj.Body= "----------------来自"+sender+"的邮件--------------"+chr(10)+chr(13)+s_string+chr(10)+chr(13)+content
'myobj.Send()
Response.Redirect(linkcontact&"?sendok=1&id="&id)

end if
end if
%>

<!-- #include file="./func.inc" -->
<!-- #include file="./begin.asp" -->
<table width="778" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" bgcolor="#FFFFEC" align="center" valign="top" height="457">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="36">
<tr>
<td width="20" background="images/nav2_bg2.gif">&nbsp;</td>
<td width="188" background="images/nav2_bg2.gif"><a href="default.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image8','','images/bt_home2.gif',1)"><img name="Image8" border="0" src="images/bt_home.gif" width="42" height="18"></a></td>
<td background="images/nav2_bg2.gif" align="center">&nbsp; </td>
</tr>
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="26">&nbsp;</td>
</tr>
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" height="36"><img src="images/company/title_sign.gif" width="14" height="18"></td>
<td class="font2"><font color="#996600"><b>联系我们</b></font></td>
<td align=right><font color="#996600">发送电子邮件给<%=toname%></font></td>
</tr>
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="images/company/point_line.gif" height="1"></td>
</tr>
<tr>
<td align="center">
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="font1" height="10"></td>
</tr>
<tr>
<td class="font1">
<%if toadd<>"" then%>
地址:<%=toadd%><br>
<%end if%>
<%if totel<>"" then%>
电话:<%=totel%>&nbsp;&nbsp;
<%end if%>
<%if tofax<>"" then%>
传真:<%=tofax%>&nbsp;&nbsp;
<%end if%><br>
<%if toemail<>"" then%>
电子邮件:<a href="mailto:<%=toemail%>" class="a12"><%=toemail%></a>
<%end if%>
</td>
</tr>
<tr>
<td class="font1" height="10"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td background="images/company/point_line.gif" height="1"></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<%if sendok=0 then%>
<table width="90%" border="0" cellspacing="0" cellpadding="0" valign=top style="line-height:200%">
<form name="ccform" method="post" action="<%=linkcontact%>?id=<%=id%>" onsubmit="return checkinput(ccform)" autocomplete = "off">
<tr>
<td height="30" align="right"><font color="#996600">标 题:</font></td>
<td> <input name="subject" type="text" class="input1" size="50" value="<%=subject%>">&nbsp;<font color=red>*</font></td>
</tr>
<tr>
<td height="30" align="right"><font color="#996600">您的信箱:</font></td>
<td><input name="from" type="text" class="input1" size="20"></td>
</tr>
<tr>
<td height="30" align="right"><font color="#996600">您的姓名:</font></td>
<td><input name="name" type="text" class="input1" size="20">&nbsp;<font color=red>*</font></td>
</tr>
<tr>
<td height="30" align="right"><font color="#996600">单 位:</font></td>
<td><input name="company" type="text" class="input1" size="50"></td>
</tr>
<tr>
<td height="30" align="right"><font color="#996600">地 址:</font></td>
<td><input name="address" type="text" class="input1" size="50"></td>
</tr>
<tr>
<td height="30" align="right"><font color="#996600">电 话:</font></td>
<td><input name="telphone" type="text" class="input1" size="30"></td>
</tr>
<tr>
<td height="30" align="right"><font color="#996600">传 真:</font></td>
<td><input name="fax" type="text" class="input1" size="30"></td>
</tr>
<tr>
<td height="26" align="right"><font color="#996600">内 容:</font></td>
<td><textarea name="body" cols="48" rows="5" class="input1"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td height="40"><input name="Submit3" type="submit" class="submit" value="提交" style="font-size: 12px; color: white; border: 1px; width: 43px; background-color: #996600">
<input name="Submit4" type="reset" class="submit" value="重置" style="font-size: 12px; color: white; border: 1px; width: 43px; background-color: #996600">
</td>
</tr>
</form>
</table>
<%else%>
<table width="80%" border="0" cellspacing="0" cellpadding="0" align="center" valign=top>
<tr height=200>
<td VALIGN="TOP" align=left class="font1"><br>
<font color=cc6600 style="font-size=12px"><b>您的留言已经发送至<%=toname%>!</b><br></font>
如有需要,我们会尽快与您联系,感谢使用。
</td>
</tr>
</table>
<%end if%>
</td>
<td bgcolor="#cc9933" valign="top" align="center" width="170">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<div id="Layer3" style="position:absolute; width:10px; height:10; z-index:2">
<div id="Layer4" style="position:absolute; width:200px; height:115px; z-index:1; left: -360px; top: -140px">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="777" height="189">
<param name="movie" value="images/18.swf">
<param name="quality" value="high">
<param name="wmode" value="transparent">
<embed src="images/18.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="777" height="189"></embed>
</object></td>
</tr>
</table>
</div>
</div>
</td>
</tr>
</table>
<table width="170" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="145">&nbsp;</td>
</tr>
</table>
<%sqltext="select * from count where enable=1 order by pl"
rs.Open sqltext,cn,1,1
do while not rs.EOF
%>
<%if rs("id")<>id then%>
<table width="170" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="images/news/nav_out_brown.gif"><a href="contact.asp?id=<%=rs("id")%>&bus=<%=bus%>" class="link2"><%=trim(rs("title"))%></a></td>
</tr>
<tr>
<td height="1"></td>
</tr>
</table>
<%else%>
<table width="170" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="images/news/nav_over_brown.gif"><a href="contact.asp?id=<%=rs("id")%>&bus=<%=bus%>" class="link2"><font color="#996600"><%=trim(rs("title"))%></font></a></td>
</tr>
<tr>
<td height="1"></td>
</tr>
</table>
<%end if%>
<%rs.MoveNext
loop
rs.Close
%>
</td>
<td bgcolor="#FFF9E1" valign="top" align="center" width="137">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="250">&nbsp;</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" height="70"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="65" height="65">
<param name=movie value="images/banner_service2.swf">
<param name=quality value=high>
<embed src="images/banner_service2.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="65" height="65">
</embed>
</object></td>
</tr>
<tr>
<td align="center" height="70"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="65" height="65">
<param name=movie value="images/banner_business2.swf">
<param name=quality value=high>
<embed src="images/banner_business2.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="65" height="65">
</embed>
</object></td>
</tr>
<tr>
<td align="center" height="70"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="65" height="65">
<param name=movie value="images/banner_careers2.swf">
<param name=quality value=high>
<embed src="images/banner_careers2.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="65" height="65">
</embed>
</object></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" bgcolor="#FFFFEC" align="center" valign="top">
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td background="images/company/point_line.gif" height="1" colspan="2"></td>
</tr>
<tr>
<td height="36" align="right"><img src="images/company/icon_top.gif" width="14" height="14"></td>
<td height="36" width="30" align="center"><a href="#" class="a02">向上</a></td>
</tr>
</table>
</td>
<td bgcolor="#CC9933" valign="top" align="center" width="170">&nbsp;</td>
<td bgcolor="#FFF9E1" valign="top" align="center" width="137">&nbsp;</td>
</tr>
<tr>
<td colspan="2" bgcolor="#FFFFEC" align="center" valign="top" height="36">&nbsp;</td>
<td bgcolor="#CC9933" valign="top" align="center" width="170">&nbsp;</td>
<td bgcolor="#FFF9E1" valign="top" align="center" width="137">&nbsp;</td>
</tr>
</table>
<!-- #include file="./end.asp" -->
<script language=Javascript>
var flag=true;
function checkinput(form)
{

if(form("subject").value=="")
{alert("请输入留言标题!");form("subject").focus();flag=false;return flag;}else{flag=true;}
if(form("name").value=="")
{alert("请填入你的姓名!");form("name").focus();flag=false;return flag;}else{flag=true;}

if (flag==true) {flag=checkchar(form("subject").value)}
if (flag==true) {flag=checkchar(form("from").value)}
if (flag==true) {flag=checkchar(form("name").value)}
if (flag==true) {flag=checkchar(form("address").value)}
if (flag==true) {flag=checkchar(form("company").value)}
if (flag==true) {flag=checkchar(form("telphone").value)}
if (flag==true) {flag=checkchar(form("fax").value)}
if (flag==true) {flag=checkcharbody(form("body").value)}

return flag;
}

function checkchar(str)
{
str=str.toLowerCase()
oldstr=str
str="2"+str
if (str.search("<"+"%")>0)
{
window.alert("("+oldstr+")中有非法字符,请检查!");
return false;
}
if (str.search("<scrip"+"t")>0)
{
window.alert("("+oldstr+")中有非法字符,请检查!");
return false;
}
if (str.search("'")>0)
{
window.alert("("+oldstr+")中有非法字符,请检查!");
return false;
}
if (str.search('"')>0)
{
window.alert("("+oldstr+")中有非法字符,请检查!");
return false;
}
return true;
}

function checkcharbody(str)
{
str=str.toLowerCase()
oldstr=str
str="2"+str
if (str.search("<"+"%")>0)
{
window.alert("("+oldstr+")中有非法字符,请检查!");
return false;
}
if (str.search("<scrip"+"t")>0)
{
window.alert("("+oldstr+")中有非法字符,请检查!");
return false;
}

return true;
}

</script>

搜索更多相关主题的帖子: 表单 sendok 页面 set 
2006-09-14 16:44
快速回复:[求助]表单提交页面显示不出来
数据加载中...
 
   



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

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