Power Pages Web Design - customized internet advertising solutions services

Processing Forms on Your Website

If you want your website visitors to give you information, you can ask them to call you, email you or even send you a letter. Or you can include a form on your website to ask specific questions for your site visitors to answer. Most businesses request an email address to send advertisements, newsletters and other information.

Once you have decided which questions to ask, you can create a form to request this information. Then you need a script to process the form information. Installing a script on your own web server is better than using a script offered by your web hosting company. You can customize it to only accept your own domain name and/or ip address to reduce spam.

The most popular script to process forms is FormMail from Matt's Script Archive. It is usually installed in a folder on your web server named cgi-bin and it is written in Perl (programming language). You can download the script, change a few variables, upload it to your web server and it should work. There are other scripts written in PHP that can process forms.

Web servers are not all created equal. The first line of the script may need to be changed for your server. The script may go in a different directory (folder) and the path will have to be changed. If your server does not allow these scripts, there are hosts that will allow you to use their scripts. This is called remotely hosted scripting.

Check with your web host to see which scripting languages they support. Then check the server path for Perl which is important for the first line of each Perl script. If using php scripts, check the server path for PHP.

Once you select a script that works for your server, read the instructions, then edit the script in Notepad or another plain editor. DO NOT edit scripts in Front Page, Dreamweaver or other WYSIWYG editors or Word or other processors. Save the file and upload with an FTP program such as CuteFTP, AceFTP or SmartFTP. Another popular free FTP program is FileZilla. DO NOT publish scripts in Front Page or other WYSIWYG editors that may add characters to the file and corrupt it. Be sure to upload scripts (in passive mode) in ASCII mode and not binary.

Now you have to set the permissions on the script. Left-click the file name on the server side in your FTP program to select that file. Then right-click to select CHMOD. Type 755 in the box. You will see read, write and execute for possible permissions for owner, group, all. Just use 755 for Perl scripts such as FormMail.pl and be sure the directory (folder) in which it resides is also 755 or 777. PHP scripts are normally 666 or 644 and often do not need to be changed.

Type the web address to your form page and enter information. Submit the information and you should receive email. If you didn't, you may have to make changes to the form, the script or the permissions. Or you may have made another mistake. The dreaded 500 error is common if you did not upload the file in ASCII mode, did not put the script in the correct directory, used the wrong url in the form action or made a syntax error (typo).

Most websites have some kind of form to get information about their visitors. You can save the information to a database or a text file, display it on a web page, or email the information for multiple uses. Please remember to include a privacy policy stating you will not sell, distribute or abuse any information obtained in your form. DO NOT use the information or your form script for spam. Your website email could be blacklisted and this could affect everyone on your web server! Simply use the information to make things easier for you and your visitors.

We discourage people from using old form processing scripts such as the old FormMail script which is one of the most commonly exploited scripts on the Internet. We encourage scripts that have the email address defined in the form processing script instead of the form. Use anti-spam techniques to prevent script abuse and reduce spam.

Yvette Kuhns, Power Pages Web Design, February 20, 2004 (Updated July 30, 2007)

Printer Friendy Version. If this article helped you, please donate any amount via PayPal. Thank you!

If you have any questions or helpful hints to share, please email me.

Please view our list of past articles for more useful information.

Back to top of page I Resources