Receiving Form Data


When your visitors click the Submit button on a form on your Web site, the data they entered into the form will be sent to you using the action you specified in your <form> tag. In Figure 11.2, we selected an e-mail action. Figure 11.7 shows you how my e-mail software returns the form data to me. You should now see why it is so important to include the name and id attributes associated with every form field.

Figure 11.7. Your e-mail software may format the responses differently, but they will all show the field names (Size and Toppings, for example), along with the data your visitor entered into those fields.


It is not always convenient to receive form data via e-mail, particularly if you expect to receive a lot of responses. Reading, and responding to, that many e-mail messages can become tiresome. Your ISP also might prefer that you do not use its mail servers in this manner.

Another action that you can assign to your forms is a script to handle the responses for you. Scripts are automated form handlers and can be used to collect all the responses in a single file and respond to the visitors for you. This book can't begin to explain how to write the scripts, or find them, but your ISP, or your network administrator, probably will have several scripts available for you to choose from and can help you attach them to your form.

Caution

All ISPs handle forms differently. Always check with your ISP or network administrator before attempting to create forms for your Web site.


Table 11.1 lists the HTML tags that were discussed in this lesson.

Table 11.1. HTML Tags Used in This Lesson

HTML Tag

Closing

Description of Use

<form>

</form>

Encloses all form elements.

<input />

 

Identifies a form field.

<option>

</option>

Identifies the contents of a drop menu.

<select>

</select>

Encloses a drop-down menu field.

<textarea>

</textarea>

Identifies a multi-lined text field.


In this lesson, you've learned:

  • All form fields should have name, id, and tabindex attributes.

  • The <form> tag always includes a method attribute (which is usually post) and an action attribute. The action can be either an e-mail address or a URL of a file that will be receiving the form's data.

  • The six form field types are text box, text area, radio buttons, check boxes, drop-down option menus, and the file browse box.



Sams Teach Yourself HTML in 10 Minutes
Sams Teach Yourself HTML in 10 Minutes (4th Edition)
ISBN: 067232878X
EAN: 2147483647
Year: 2004
Pages: 151
Authors: Deidre Hayes

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net