我自己做了一留言板.但是留言的信息在数据库没有啊,请大家帮帮忙.应该加上什么代码就可以了.是ASP+ACCCESS的.
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>
文件中的代码我都发上来了,大家帮帮忙吧!