Cgi入门教程之:7 回应脚本
点击次数:29 次 发布日期:2008-11-26 15:07:46 作者:源代码网
|
源代码网推荐这段脚本将显示输入到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 "; 源代码网推荐# 源代码网推荐#*****************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****************** 源代码网推荐 源代码网供稿. |
