How to write HTML forms

This document provides annotated links to tutorials, references, FAQs, and my specialized documents about HTML forms.

To use HTML forms, you need to know how to write a FORM element, containing suitable fields. That's covered well in the tutorials mentioned below. But additionally, you need a form handler, which is some software which processes the form data in some way, e.g. by sending it by E-mail to you or by storing it to a file which you can access. There are several possibilities:

Warning: The use of action="mailto:..." is often suggested. However, it has undefined effect. Although some browsers in some configurations support it, the above-mentioned approach is much better - more reliable and more flexible (allowing e.g. nice formatting of the data and redirecting the user to a "thank you" page, etc). Thus, you should never use action="mailto:..." on Web pages! See also: The mythical Mailto:.

General tutorials

Reference material

The ultimate reference on HTML is currently the HTML 4.01 Specification, which contains a separate section on forms. Please note that many of the features have not been implemented yet even in newest versions of browsers. For some browser vendors' own words about the implementations, see section Forms in Netscape's HTML Tag Reference and the descriptions in Microsoft's HTML Elements (which describes the HTML support in Internet Explorer).

The HTML 4.0 Reference by WDG contains detailed descriptions of all constructs in HTML 4.0 and examples of their usage. (The elements directly related to forms are: BUTTON, FIELDSET, FORM, INPUT, LABEL, LEGEND, OPTGROUP, OPTION, SELECT, TEXTAREA.) It also provides, in the element descriptions, links to the ultimate specifications: applicable sections in HTML 2.0, HTML 3.2, and HTML 4 specifications. That reference also contains warnings about HTML 4 form features not implemented yet in most browsers. See section Forms in HTML 4.0 in Netscape and Explorer for a good summary of the status of browser support (and my margin notes to it for some details).

Frequently asked questions

There are several questions related to forms in WDG's Web Authoring FAQ, including

See also:

Note that some of the documents of mine listed below answer other frequently asked questions like "how do I create pulldown menu for navigation", "how do I get rid of the ugly grey button", and "how do I control how form fields are displayed".

Specialized material

I have written some documents on special topics about forms or related to them:


As regards to accessibility of forms in general, I'd recommend Jim Thatcher's Accessible Forms in his Web Accessibility for Section 508 and the material How to Create Accessible Forms at WebAIM.


This page belongs to section Web authoring and surfing of the free information site IT and communication by Jukka "Yucca" Korpela.