| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 457 人关注过本帖
标题:上次自己做的留言板的代码
只看楼主 加入收藏
wangyu1986
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-5-13
收藏
 问题点数:0 回复次数:0 
上次自己做的留言板的代码

board.asp文件
<!--#include file="conn.asp"-->

<style type="text/css">
<!--
.style2 {
font-size: 16px;
font-weight: bold;
}
-->
</style>
<table width="300" border="0" align="center">
<tr>
<td align="center"><span class="style2">留言板查看</span></td>
</tr>
</table>
<br>
<br>
<table width="200" border="0" align="center">
<tr>
<td align="center"><a href="send.asp">发表留言</a></td>
</tr>
</table>
<br>
<br>
<%
set rs=conn.execute("select * from board order by id desc")
do while not rs.eof
%>
<table width="600" border="0" align="center" cellspacing="1" bgcolor="#999999">
<tr bgcolor="#FFFFFF">
<td width="447"><%=rs("title")%></td>
<td width="146"><%=rs("subtime")%></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2"><%=rs("content")%></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2"> </td>
</tr>
</table>
<%
rs.movenext
loop
rs.close
set rs=nothing
conn.close
set conn=nothing

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; ch***t=gb2312">
<title>请您留言</title>
<style type="text/css">
<!--
.style1 {font-size: 18px}
-->
</style>
</head>

<body>
</body>
</html>


conn.asp代码
<%
dim conn,connstr,mdb
mdb="board.mdb"
on error resume next
Connstr="DRIVER=Microsoft Access Driver (*.mdb);DBQ="+server.mappath(mdb)
Set Conn=Server.CreateObject("ADODB.Connection")
conn.Open connstr
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
%>


send.asp文件代码
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; ch***t=gb2312">
<title>请您留言</title>
<style type="text/css">
<!--
.style1 {font-size: 18px}
-->
</style>
</head>

<body>
<table width="700" border="0" align="center">
<form name="form1" method="post" action="sendok.asp">
<tr>
<td><div align="center" class="style1">发布留言</div></td>
</tr>
<tr>
<td height="50" align="center">标题:
<input name="title" type="text" size="50" ></td>
</tr>
<tr>
<td align="center">内容:
<textarea name="content" cols="50" rows="30"></textarea></td>
</tr>
<tr>
<td align="center"><input type="submit" name="Submit" value="提交">
<a href="board.asp">查看留言</a> </td>
</tr>
</form>
</table>
</body>
</html>


sendok.asp文件代码
<!--#include file="conn.asp"-->
<%
title=request.form("title")
content=request.form("content")
Subtime=now()
conn.execute("insert into board (title,content,Subtime) values('"&title&"','"&content&"','"&Subtime&"')")
%>
<script>
alert("留言成功!");
location.href="board.asp";
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; ch***t=gb2312">
<title>请您留言</title>
<style type="text/css">
<!--
.style1 {font-size: 18px}
-->
</style>
</head>

<body>
</body>
</html>
文件中的代码我都发上来了,大家帮帮忙吧!

搜索更多相关主题的帖子: 留言 代码 
2006-05-13 17:05
快速回复:上次自己做的留言板的代码
数据加载中...
 
   



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

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