Shared-CGI: AlienForm2

AlienForm2 is a standard Form-to-Email CGI with the following features

  • Full control of all HTML pages & e-mail messages by creating your own templates.
  • Can enforce required form fields.
  • Can do basic validation of form fields.
  • Very flexbile.

To use AlienForm2 in your own forms, follow the steps below

First . . .

Start your form with a tag directing the output to AlienForm2, like this:

<FORM method="POST" action="/shared-cgi/af.pl">

Second . . .

Create a template for the email message to be sent when the form is completed.

Your template file might look like this:

---------------------------- Cut here -----------------------
From: wwwserver@yourdomain.com
To: sales@yourdomain.com
Subject: Info Request Form Results

The following request was submitted to our Info Request Form at: [%HTTP_REFERER]

It was submitted from: [%REMOTE_ADDR]

Name: [r_name]
Address: [address]
Company: [company]
Phone: [phone]
Fax: [fax]
E-mail: [re_email]

The would like info about: [infoneeded]
---------------------------- Cut here -----------------------

Note: The From, To, and Subject lines must be seperated from the rest of the lines by a blank line. They must also contain valid email addresses.

Save this template to a file on your web site, for example: /html/inforequest/email.txt

Third . . .

Add a hidden field, _send_email, to your form. Specify the name of your template file as the value for this hidden field.

<input type="hidden" name="_send_email"
            value="/yourdomain.com/html/inforequest/email.txt">

Fourth . . .

Create the HTML file to be displayed when someone has completed the form. This file can contain variables that will be filled in with information from the submitted form.

Your HTML might look like this:

---------------------------- Cut here -----------------------
<HTML>
<TITLE>Form Results</TITLE>
<BODY>
<img src="ourlogo.gif"><BR>
Dear [r_name],<BR><BR>
Thank you for filling out our form.<BR>
We will send the info you requested about
[infoneeded] right away.<BR>
</BODY>
</HTML>
---------------------------- Cut here -----------------------

Save this HTML to a file on your web site, for example: /html/inforequest/thankyou.html

Fifth . . .

Add a hidden field, _browser_out, to your form. Specify the name of your template file as the value for this hidden field.

<input type="hidden" name="_browser_out"
value="/yourdomain.com/html/inforequest/thankyou.html">

Optional . . .

Additional email messages can be defined and sent. See the full documenation for that and other features.

Here is a local copy of the Full documentation originally found on Jon's CGI-Scape, the home of AlienForm.