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/6/Form.php
HTML Script |
Web Display |
<form method="post" name="input" action=
"http://undcemcs01.und.edu/~wen.chen.hu/course/101/6/Form.php">
User 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.