Working with Form Properties

You now must specify where to send the form data and how to send it. To control how information entered into your form is processed, you must modify the properties of the <FORM> tag. There are three properties you'll work with: ACTION, METHOD, and ENCTYPE.

The ACTION property identifies the CGI script that will process your form. The syntax for this property is:


where URL is the URL of the CGI script. Your Internet Service Provider or the person requesting the form design will provide this information for you. If you are provided with the fictitious URL you would still need to determine how to send this information. The METHOD property controls how your Web browser send data to the Web server running the CGI script. The syntax for the METHOD property is:


where type is either GET of POST.

The final form property you might have to be concerned with is the ENCTYPE property. The ENCTYPE property specifies the format of the data when it is transferred from your Web page to the CGI script. The syntax of this property is:


where Text is the data format.

If you were to use this format, you would change the <FORM> tag to read:


There is no need to enter this into the form, however, this lets you know how to use this method.

Using the MAILTO Action

There is a way to send form information through e-mail without using a script. This action accesses the user's won mail program and uses it to mail form information to specified e-mail address, bypassing the need for using CGI scripts on a Web server. The syntax of the MAILTO action is:

<FORM ACTION="mailto:e-mail_address" METHOD=POST>

where e-mail_address is the e-mail address of the recipient of the form information. Because the MAILTO action does not require a CGI script, you can avoid some of the problems associated with coordinating your page with a program running on the Web server.

When you click the Submit button on a form that uses the MAILTO action, the operating system invokes the mail program and receives the content for the mail message from your Web browser.

An e-mail message generated by the MAILTO action is full of special characters that must be interpreted either by you or by a special translation program before the message can be read. To see an example of an e-mail message that the MAILTO action generated for a form, turn to page 6.39 in your textbook.