HTML and CSS Reference
In-Depth Information
the check box selection, which is controlled by the field named musictype. The user then
clicked the radio button option for the iTunes option, which is controlled by the field
named purchases. The user also selected the radio station Pandora in the selection menu.
An ampersand (&) strings together all of the name-value pairs to make them easier to
read. The receiver of this e-mail could take the information in this format and decipher
what is being requested. A simple program, written in a different programming language
such as C++ or Java, could be developed that reads the information in the e-mail and
transforms it into a more usable format. As mentioned earlier in the chapter, a CGI script
is a better way to collect large amounts of information from forms, but that is beyond the
scope of this topic.
The Reset button is also an important part of any form. Resetting the form clears
any information previously typed into a text box or textarea and resets radio buttons,
check boxes, selection menus, and other controls to their initial values. As shown in the
second line of the HTML code above, a Reset button is created by using the attribute
type="reset" in an <input /> tag. The value attribute is used to indicate the text that should
appear on the button face — in this case, Reset.
To Add Submit and Reset Buttons
The following step adds a Submit button and a Reset button to the form.
1
Highlight the state-
ment <!--Insert Submit
and Reset buttons
here --> on line 53.
<p><input
type=”submit”
value=”Submit” />
to create the Submit
button and then press
the e n t e r key.
Type
Submit
button added
word Submit appears
on button
word Reset appears
on button
Reset button
added
<input
type=”reset”
value=”Reset” />
to create the Reset button. Do not press the e n t e r key (Figure 6-19). Save your code.
That submit option seems very easy to use. Do I need to do anything else in order to process the data?
No, the Submit button works in conjunction with the statements that you provided in your form tag in
order to process the data entered.
Type
Figure 6-19
Why do I need the Reset button?
It is always best to provide a Reset button next to the Submit button. This is useful to clear all of the data
entered in case your visitors want to start over or if they change their minds or make mistakes.
If a visitor uses the Reset button, what does that do to default values that I have included in the tags?
Reset will set those default values back to the original values included in the tags. In other words, if you
use a default value, Reset does not clear that value.
 
Search WWH ::




Custom Search