前辈们近来帮看下,谢谢 !
这个是第一个文件. index.asp
为什么我点添加就是保存,那个联系人的内容也获取不到.等,大虾们帮看下,谢谢了!
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>留言版</title>
</head>
<body topmargin="0">
<table cellpadding="0" cellspacing="0" border="1" width="960" height="550" align="center" background="image/dp.jpg">
<form action="add.asp" method="post" name=form1>
<tr>
<td width="150"> </td>
<td width=660" align="center">
<table width="660" height="61%" border="0" align="center" >
<tr><td height="20"> </td>
</tr>
<tr><td height="50"><div align="center"><font size="6" color="#FF0000">留言版</font></div></td>
</tr>
<tr><td height="250"><table width="100%" height="100%" border="1">
<tr >
<td height="25" ><font size="4" color="#000000">标题</font></td>
<td height="25"><div align="left">
<input name="text" type="text" size="25" />
</div></td>
</tr>
<tr>
<td height="25"><font size="4" color="#000000">联系人</font></td>
<td><div align="left">
<input name="lianxi" type="lianxi" id="lianxi" size="25"/>
</div></td>
</tr>
<tr>
<td height="100"><font size="4" color="#000000">内容</font></td>
<td><div align="left">
<textarea name="body" cols="40" type="body" rows="10"></textarea>
</div></td>
</tr>
<tr><td> </td><td >
<div align="left">
<input type="submit" name="submit" value="确 定">
</div></td></tr>
</table></td>
</tr>
<hr>
<tr><td height="200"><table width="100%" height="100%">
<%
sql="select * from mail order by ID desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<% if rs.eof then
Response.Write"没有留言!"
else
%>
<% do while not rs.eof %>
<tr>
<td><%=rs.title%></td>
</tr>
<tr>
<td><%=rs.name%></td>
</tr>
<tr>
<td><%=rs.body%></td>
</tr>
<tr><td><%=rs.data%></td>
</tr>
<% rs.movenext
loop
%>
<% end if %>
<% rs.close
set rs=nothing
%></table></td>
</tr>
</table>
</td>
<td width="150"> </td></tr>
</tr>
</form>
</table>
</body>
</html>
添加文件是 add.asp
<%
dim conn,sql,con
set conn=server.CreateObject("adodb.connection")
con="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath("db.mdb")
conn.Open con
dim text,body,lianxi,data_up
text=request.Form("text")
body=request.Form("body")
lianxi=request.Form("lianxi")
data_up=now()
sql="insert into mail(text,body,[lianxi],data_up) values('"&text&"','"&body&"','"&lianxi&"','"&data&"')"
response.write (sql)
conn.execute(sql)
Response.Write"<script language='javascript'>alert('添加成功!')</script>"
'response.redirect "index.asp"
%>