HTML and CSS Reference
In-Depth Information
A summary of the steps in producing a form follows:
1. START: Start the form with the HTML
<form>
tag.
2. ACTION: The
action
attribute of the
<form>
tag is the URL of the server-side
(CGI) script that will process the data input from the form.
3. METHOD: Provide a method on how to process the data input. The default is
the
get
method.
4. CREATE: Create the form with buttons, boxes, and whatever looks attractive
using HTML tags and fields.
5. SUBMIT: Create a submit button so that the form can be processed. This will
launch the PHP, ASP.NET, or CGI script listed in the
action
attribute.
6. END: End the form with the
</form>
tag.
Table 11.4 shows the various form input types.
Table 11.4
HTML Form Controls
Input Type
Attribute
Description
button
name, id
Creates a generic button for user input. It has no default
action.
text
name, id, size, maxlength
Creates a textbox for user input.
size
specifies the size of
the textbox.
maxlength
specifies the maximum number of
characters allowed.
textarea
name, id, size,
rows, cols
Creates a text area that can take input spanning multiple
lines.
rows
and
cols
specify the size of the box.
password
name, id, value
Like textbox but input is hidden. Asterisks appear in the
box to replace characters typed.
checkbox
name, id, value
Displays a square box that can be checked. Creates
name/value pairs from user input. Multiple boxes can be
checked.
radio
name, id, value
Like checkboxes, except only one button (or circle) can be
checked.
select
name, id, option,
size, multiple
Provides popup menus and scrollable lists. Only one can be
selected. Attribute
multiple
creates a visibly scrollable list.
A
size
of 1 creates a popup menu with only one visible box.
file
name, id
Specifies files to be uploaded to the server. MIME type must
be
multipart/form-data.
hidden
name, id, value
Provides name/value pair without displaying an object on
the screen.
Continues