回應腳本 這段腳本將顯示輸入到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******************
|