| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 734 人关注过本帖
标题:为什么这个留言簿只能显示一条留言
取消只看楼主 加入收藏
不想从修
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2005-5-3
收藏
 问题点数:0 回复次数:0 
为什么这个留言簿只能显示一条留言
近日 在学习一个留言簿程序的时候 在生成一个book.txt文件后 为什么在这个文件中只能有一条留言,后面的留言都将会被一一覆盖 反正就只有一条留言
book. asp的代码如下:
<%@ Language=VBScript %>
<%
name=Request.Form ("text1")
email=Request.Form ("text2")
subject=Request.Form ("text3")
memo=Request.Form ("textarea1")
if name="" or email="" or subject="" or memo="" then
Response.Write "输入框不能是空白"
Response.End
end if
'第一行显示内容
line1="留言人:"&name
line1=line1&string(5," ")
email="<a href=mailt"&email&">"&email&"</a>"
line1=line1&"email:"&email&"<br>"
'第二行显示内容
line2="主题:"&subject&"<br>"
'第三行
memo=replace(memo,vbcrlf,"<br>")
line3="<table border=0 bgcolor=#ffffff><tr><td>"
line3=line3&memo&"</td></tr></table>"
'第四行为留言时间
line4="时间:"&now()
on error resume next
set fso=server.CreateObject ("scripting.filesystemobject")
Application.Lock
filepath=server.MapPath ("book.txt")
oldfilepath=server.MapPath ("bookold.txt")
fso.MoveFile filepath,oldfilepath
set fin=fso.OpenTextFile (oldfilepath,true)
set fout=fso.CreateTextFile (filepath)
fout.writeline line1
fout.writeline line2
fout.writeline line3
fout.writeline line4
fout.writeline fin.readall
fin.close
fso.DeleteFile oldfilepath,true
Application.UnLock
Response.Redirect "showbook.asp"
%>
搜索更多相关主题的帖子: 留言簿 
2005-05-06 09:19
快速回复:为什么这个留言簿只能显示一条留言
数据加载中...
 
   



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

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012995 second(s), 8 queries.
Copyright©2004-2025, BC-CN.NET, All Rights Reserved