Categories


CGI Script – How to Configure

cgi

 

Unless you are familiar with writing Perl, the easiest way to get your forms up and running quickly is to download a script from the internet and configure it for your domain. You can download a file from http://www.scriptarchive.com/formmail.html. There are also a lot of other scripts available on this website, so you may want to bookmark the site.

The formmail you will download will contain 2 files:

  1. FormMail.pl – this script will process the form and deliver the results via email.
  2. ReadMe File – details description of use as well as installation instructions.

Two things to do before you begin:

  1.  You should save a copy of the original file containing the script under another name – possibly in another folder. This way should you make a mistake or accidentally change, delete, or overwrite something you shouldn’t have – you’ll still have a clean copy of the original.
  2. You should also review the README file. Once you have completed these 2 things you can begin.

(All code is shown in blue.)

You will need to reconfigure 2 lines of code. They are:

@referers

@recipients

The @referers line of code will contain your domain name and the domain’s IP address.

Example: @referers = (‘yourdomain.com’,’111.222.33.45′);

The @recipients line will contain the email address(es) that are to receive the email results once the form has been submitted. You can designate more than one email address to receive the results.

Example: @recipients = (‘^request\@yourdomain\.com’, ‘info\@yourdomain\.com’);

Once you have made the changes, you will save the file and upload it to the CGI-bin in the root directory of your domain. This location is used in the

 line of HTML code for processing the form.

Example: [where the dots are the name of the file with correct extension].

Once you have the file uploaded, you are ready to test your form. In order to test the form both the HTML form document and the CGI script file must be uploaded, and you should be connected to the Internet. You can then go to the form by typing its location in the address bar, i.e. http://www.yourdomain.com/form.html.  Once the form displays on the screen, fill in the blanks and ‘submit’.

Should you receive an error message go back to the original files (both the CGI script and the HTML form). Here you will want to check for typo’s, to make sure case sensitive letters match, check to see if the IP address is correct and that the email recipients email addresses are accurate. Make changes as needed. Upload the corrected files and re-check the form.

Once you have your forms working properly, you may find it helpful to keep the CGI script file and the form files in a separate folder in your computer.


Comments are closed.