Simple implementation of Simple Forms


This document should be of interest to anyone who would like to implement simple forms (e.g. feedback, survey, order forms) without having to write a CGI script to handle them. The concept is fairly simple: there is a general script which formats the output of a form and sends it as e-mail to a specific user or set of users. The only configuration needed on the part of the server administrator is to include the target e-mail address in a list.

If you are familiar with fill-out forms it will take you just a few minutes to write your first one! If you are not familiar with them you will need to learn about the tags you can include in a form and what they mean. The best way to learn is by looking at forms you find around the Web and trying it out.

Then look at the sample form I created. It is linked here as an HTML file and as a TEXT file. This is a fairly general form where I included all the possible tags (except tables). The one feature which is important to the extent of the kind of output the form will return to you are the names I assigned to the NAME of all the tags. The script will return the content of a tag paired to its name in alphabetical order. This is a sample output.

Therefore if you want to have the results in a nice format you will have to give alphabetical NAMEs to your INPUTs and TEXTAREAs just like in the example. If the user does not fill an area the script simply ignores the NAME VALUE pair.

Now it is possible to automate the processing of form output by using the script grind.pl which is a perl script intended to process the output of a form as received as mail. The script creates an associative array which can be used as you want to e.g. create and update a database.

Also, this same form can be used as E-mail by the user. This can be usevul since many browsers out these still do not support the mailto: HREF. So you can simply reference the simple-form cgi script as <A HREF="/cgi-bin/simple-form?Name">Your Full Name</A> and have a nice mail interface for all users. You can try it out right now.

Finally, if you have questions feel free to send me email.


Page created/updated by Marco Falcioni