HTML and CSS Reference
EXPLANATION ( CONTINUED )
The input type is a textbox that will hold up to 50 characters. When the user types
text into the textbox, that text will be stored in the user-defined name value,
your_name . For example, if the user types Stefan Lundstrom , the browser will as-
sign to the query string, your_name=Stefan Lundstrom. If assigned a value attribute,
the text field can display a default text string that appears in the textbox when it
nipulate the form element.
The user is asked for input. The text area is similar to the text field, but will allow
input that scans multiple lines. The <textarea> tag will produce a rectangle named
“comments” with dimensions in rows and columns (5 rows × 50 columns) and an
optional default value ( I was born...).
The user is asked to pick from a series of menu items. The first input type is a list
of radio buttons. Only one button can be selected at a time. The input type has two
attributes: a type and a name . The value of the name attribute “choice” , for example,
will be assigned “burger” if the user clicks on the Hamburger option. choice=burger
is passed onto the PHP program. And if the user selects Fish , choice=fish will be as-
signed to the query string. These name/value pairs are used to build a query string
to pass onto the PHP program after the Submit button is clicked.
The input type this time is in the form of checkboxes. More than one checkbox
can be selected. The optional default box is already checked. When the user se-
lects one of the checkboxes, the value of the name attribute will be assigned one
of the values from the value attribute; place=LA if Los Angeles is checked.
The user is asked for input. The <select> tag is used to produce a popup menu
(also called a drop-down list) or a scrollable list. The name option is required.
It is used to define the name for the set of options. For a popup menu, the size
attribute is not necessary; it defaults to 1. The popup menu initially displays one
option and expands to a menu when that option is clicked. Only one selection
can be made from the menu. If a size attribute is given, that many items will be
displayed. If the multiple attribute is given (as <select multiple name=“whatev-
er”> ), the menu appears as a scrollable list, displaying all of the options and the
user can select more than one option by holding down the Ctrl key while click-
ing the option.
If the user clicks the Submit button, the PHP script listed in the form's action at-
tribute will be launched. The form data will be URL encoded and sent to the serv-
er program assigned to the form's action attribute.
If the reset button ( “Clear” ) is pressed, all input boxes are reset to their defaults.
This tag ends the form. The output is shown in Figure 11.8.