[an error occurred while processing this directive] CGI - A free tutorial for the Total Non-Programmer.
CGI - Let's get startedCGI - Introduction to Perl

The e-mail subroutine


#*****************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>";

$to = $email;
$from = "clinton\@whouse.gov";
$sub = "subject of my first e-mail";
$body = "The form was filled out by $firstname $lastname
Thank you goes on another line.";

&email($to,$from,$sub,$body);
 
#***************END BODY******************



In the example above I have added 7 lines (including the blank one) to the end of the program body.  You will want to copy these lines, and append them to the body of test2.cgi.  There are 2 ways to do this.


 

Once you have appended the additional lines to the body of test2.cgi you can try the form again.  Be sure to enter your own email address on the testform.htm page, or else someone will get a very confusing message.  When you submit the form, it will show you the same display as before.  This time, however, if you check your e-mail after a few seconds, you will have a message from President Clinton.


 

Let's review the additional lines:


 
$to = $email;
          

This line simply copies the contents of the variable $email to the variable, $to.

$from = "clinton\@whouse.gov";

$sub = "subject of my first e-mail";
        

This one is pretty straightforward.

$body = "The form was filled out by $firstname $lastname
Thank you goes on another line.";

&email($to,$from,$sub,$body);

BACKHTML Form | Guestbook Form | Hit Counters

Home | WebData - Web Database Software | Javascript | CGI | Consulting | Map Builder | Contact Us | The Press Room