回应脚本
这段脚本将显示输入到html form中的文本。它是一个信息如何传递给你的程序的简单的例子。既然你现在已经有了一个有着正确的perl和senmail的路径的template.txt文件,下面要做的只是编辑cgi的body部分。
拷贝下面脚本的body部分到template.txt,然后保存到一个新文件"test2.cgi"中。
ftp test2.cgi到perltour文件夹(或cgi-bin)中。
然后在unix提示符下,进入perltour(或cgi-bin)文件夹,敲入chmod a+rx test2.cgi设置权限。
现在可以在你的浏览器中打开服务器上的testform.htm,测试这个form。当你填充这个form并按"test it"时,cgi告诉你你输入了什么。
--------------------------------------------------------------------------------
#!/usr/local/bin/perl
#
&readparse;
print "content-type: text/html\n\n";
#
#*****************begin body*************
print "<h1>thank you for filling out the form</h1>";
$firstname = $value[0];
$lastname = $value[1];
$email = $value[2];
print "your first name is $firstname<br>";
print "your last name is $lastname<br>";
print "your e-mail is $email<br>";
#***************end body******************