The Echo script
This script will display whatever text was entered into
the HTML form. It is a simple example of how the information is passed to
your program. Since you now have a template.txt file with the correct path
to Perl and Sendmail, you only need to edit the BODY of the CGI from now on.
- Copy and paste the BODY
section of the following script into template.txt, and save it
as a new page called 'test2.cgi'.
- Use your FTP program to upload
test2.cgi to the perltour folder (or the cgi-bin).
- Then from a Unix prompt, change to
the perltour (or cgi-bin) directory and type chmod a+rx test2.cgi to set the privilages.
- You should now be able to point
your browser to testform.htm on your server, and
test the form.
When you fill in the form and press 'Test It', the CGI
should tell you what you entered.
#!/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******************
Break down the
code