源码在这
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, HTTPApp;
type
TWebModule1 = class(TWebModule)
procedure WebModule1infoAction(Sender: TObject; Request: TWebRequest;
Response: TWebResponse; var Handled: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
WebModule1: TWebModule1;
implementation
{$R *.DFM}
procedure TWebModule1.WebModule1infoAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
html:string;
Output: TextFile;
Counts:integer;
begin
Assignfile(Output, 'guestbook.txt');
Append(output);
for counts:=0 to Request.ContentFields.Count-2 do
begin
Write(Output, Request.ContentFields.Strings[counts]);
Writeln(Output,' ')
end;
Writeln(Output,'---------------------------------------------');
CloseFile(output);
html:='';
html:=html+'<html><head><title>谢谢!</title></head><body bgcolor="#CCCCFF">您的留言如下';
html:=html+'<pre>您的姓名: '+Request.ContentFields.Values['yourName']+'</pre>';
html:=html+'<pre>电子邮件: '+Request.ContentFields.Values['email']+'</pre>';
html:=html+'<pre>留言: '+request.ContentFields.Values['contents'] +'</pre>';
html:=html+'</body></html>';
Response.Content :=html;
end;
end.