Tutorial 6: Working With Forms II
(The CGI)
The following tutorial
presupposes that you have some familiarity with HTML authoring.
It does not teach you how to write a CGI script.
This is the script that handles the form in: template5.html.
Go to Tutorial5 to learn how to create the corresponding
HTML document that contains the form.
Go to template6.pl to see this script.
This tutorial further assumes that you have the permission to install CGI scripts on your web server, and that this server runs the UNIX operating system and makes the Perl programming language available to you. Your system administrator or webmaster should be able to help you with specific questions.
The example script has been tested and is known to work on the following system:
Note:
# ********** #
are the lines that
we will have to modify to suit our specific system and
exercise.
Changes you need to make to the example CGI script:
#!/usr/bin/perl
An easy way to find out what should go into this line is to type
which perl
in your UNIX
system's shell. The output of this commant should
follow the # ! characters on the first line of the
script. Also, your system administrator or webmaster
should be able to tell you what goes in there.
$mailprog = '/usr/sbin/sendmail';
$teacher = ('jarana@leia.ursinus.edu');
blank_&response unless $FORM{'FieldName'};
where FieldName are the names of all
required fields in the HTML form. Each form element
(pull-down menu, check box, etc.) that you want to be required
needs to appear in one of these lines.
print MAIL "text";
where text is the the text
that you will get in the e-mail message.