Form Scripts and Script Services - HTML

As previously mentioned in the Understanding Forms section in this chapter, form data is typically passed to a data handler, a script or program that does something useful with the data.

Form handlers typically do one or more of the following actions with the form data:

  • Manipulate or verify the data
  • E-mail the data
  • Store the data in a file or database

The <fieldset> tag can help add organization to your forms.

The <fieldset> tag can help add organization to your forms.

There are many ways to construct a form handler, but the usual method is by using a server-side programming language to create a script that does what you need to the data. Common form handlers are created in Perl, Python, PHP, or other server-side programming language.

Security is an issue that should be considered when creating form handlers. One of the earliest, most popular form handlers, formmail.cgi, was found to have a vulnerability that allowed anyone to send data to the script and have it e-mail the data to whomever the sender wanted.

This functionality was an instant hit with e-mail spammers who still use unsecured formmail scripts to send anonymous spam. Because form-handling scripts can be so diverse (performing different functions, written in different languages), it is hard to give tangible examples here. You should use a language you are comfortable with to create a form handler that does exactly what you want.

If you want a generic form handler to simply store or e-mail the data, you can choose from a few routes.

The <legend> tag can add captions to your fieldsets.

The <legend> tag can add captions to your fieldsets.

Download a handler
Several sites on the Internet have generic form handlers available. One of my favorites is the CGI Resource Index. This site has several dozen scripts that you can download and use for your form handling.

Use a script service
Several services are also available that allow you to process your form data through their server and scripts. You may need such a service if you cannot run scripts on your server or want a generic, no-hassle solution. A partial list of script services is available at the CGI Resource Index. From the main page, select Remotely Hosted and browse for a service that meets your needs.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

HTML Topics