HTML Forms and Input (Cont.)
Checkboxes
Checkboxes are used when you want the user to select one or more options of a limited number of choices.
HTML Script |
Web Display |
<form>
<input type="checkbox" name="bike" checked />
I have a bike
<input type="checkbox" name="car" />
I have a car
</form>
|
|
The Form’s Action Attribute and the Submit Button
The form’s
action
attribute defines the name of the file that the content will be sent to; e.g., the text entered in the text field below will be sent to a file named
http://undcemcs01.und.edu/~wen.chen.hu/course/101/7/Form.php
HTML Script |
Web Display |
<form method="post" name="input" action=
"http://undcemcs01.und.edu/~wen.chen.hu/course/101/7/Form.php">
Name:
<input type="text" name="user" />
<input type="submit" name="act" value="Submit" />
<input type="submit" name="act" value="PHP source" />
</form>
|
|
Tag |
Description |
|
Tag |
Description |
<form> |
Defines a form for user input. |
<input> |
Defines an input field. |
<textarea> |
Defines a text-area. |
<label> |
Defines a label to a control. |
<fieldset> |
Defines a fieldset. |
<legend> |
Defines a caption for a fieldset. |
<select> |
Defines a selectable list. |
<optgroup> |
Defines an option group. |
<option> |
Defines an option in the drop-down box. |
<button> |
Defines a push button. |
Demonstration
The following demonstration shows how the HTML script is displayed on the Web.
What is the last thing to go through a fly’s head
as it hits the windshield of a car going 70 mph?
Its butt.
|