<! --# include file="conn.asp"-->
<%
cname=request.form("cname")
ctel=request.form("ctel")
cemail=request.form("cemail")
caddress=request.form("caddress")
ccontent=replace(request.form("ccontent"),vbcrlf,"/")
if cname<>""then
sql="select * from gbook" '连接对应的数据表
set rs=server.createobject("adodb.recordset")
rs.open sql,connstr,3,2
rs.addnew '添加新字段
rs("name")=cname
rs("tel")=ctel
rs("email")=cemail
rs("address")=caddress
rs("content")=ccontent
rs.update
response.redirect "lyok.asp" '重定向到留言成功提示窗口
rs.close
end if
%>
<html>
<head>
<style type="text/css">
<! --
td {font-size:14px;line-height:17px}
body {font-size:14px;line-height:17px}
p {margin-top:1;margin-bottom:1}
.style1{color:#D4D0C8}
-->
</style>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<title>asp动态程序──简单留言板</title>
<script language="javascript">
<!--
function checkadd()
{
if(document.postart.cname.value.length<1)
{
alert("请输入昵称!");
document.postart.cname.focus();
return false;
}
if(document.postart.ccontent.value.length<1)
{
alert("请输入留言!");
document.postart.ccontent.focus();
return false;
}
}
-->
</script>
</head>
<body>
<div align="center" style="width:720;height:500">
<form action=""method="post" name="postart">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="280">
<tr>
<td><div align="center">简单留言本</div></td>
</tr>
<tr>
<td width="70%" align="right" valign="middle" height="99">
<p align="left">昵 称:<input type="text" name="cname" size="30" maxlength="50" style="border: 1 solid #000000"></p>
<p align="left">电 话:<input type="text" name="ctel" size="30" maxlength="50" style="border: 1 solid #000000"></p>
<p align="left">E-mail:<input type="text" name="cemail" size="30" maxlength="50" style="border: 1 solid #000000"></p>
<p align="left">主 页:<input type="text" name="caddress" size="30" maxlength="50" style="border: 1 solid #000000" value="http://"></p>
</td>
</tr>
<tr>
<td width="70%" align="right" valign="top" height="27">
<p align="left">留言内容:</td>
</tr>
<tr>
<td width="70%" align="right" valign="top" height="22">
<p align="left"><textarea rows="4" name="ccontent" cols="49" style="border:1 solid #000000"></textarea></td>
</tr>
<tr>
<td width="100%" align="right" height="40" colspan="2">
<p align="left"><input type="submit" value="提交" name="submit">
<input type="reset" value="取消" name="reset">
<input type="button" value="返回" name="back">
</td>
</tr>
</table>
</form>
<%
sql="select * from gbook order by id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,connstr,1,1
i=0
if rs.eof then
response.write "暂无留言!"
else |