Section 64. About Forms

64. About Forms


6 About Proper HTML Coding

A form must have four things in HTML to do work:

  • A <FORM> tag to enclose the elements of the form

  • Form elements so that viewers can enter text or select from a set of choices

  • Some way to tell the browser that the viewer is finished and ready to submit the form

  • Some script or program on the server to capture the information the viewer has sent so that something can be done with it

To get an idea of how a form works, you are going to look at one and deconstruct it to see the different elements.

Open your browser and go to and then click on buy from the menu along the top of the page.

You are probably familiar with eBay . To find what you want on a site where there are hundreds or thousands of pages changing every minute, you can either browse by category and go through a complicated tree of choices to find your Shaker ladder-back chair, or you can use the search function at the top of the page to look for your chair directly.

Type in Shaker ladder-back chair into the text area and click on the Search button.

Your results will look different each day because there are different sets of items for sale, but you will see that you have been given a list of chairs that are currently available.

To get here, you used a form that enclosed four form elements: the text area where you entered the search terms, a drop-down box that let you limit the search to a particular area of the site (such as furniture or antiques ), a box that let you search in just the titlesthe defaultor in the titles and descriptions, and a Search button that submitted the information to the application that did the searches.

Each element has a tag. There are quite a few elements in HTML that you are able to use, but most are not used in every form. Those tags used will highlight interface properties like size and color and other options that will make the form stand out and be more useable.

Sams Teach Yourself Creating Web Pages All in One
Sams Teach Yourself Creating Web Pages All in One
ISBN: 0672326906
EAN: 2147483647
Year: 2006
Pages: 276 © 2008-2017.
If you may any questions please contact us: