htmlForm tags: "
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
HTML forms are used to collect different types of user input. Form elements refer to different types of input elements, check boxes, radio buttons, submit buttons, etc.
HTML form tags:
Tags | Description |
---|---|
Define the form for user input | |
Define the input field | |
Define the text area (a multi-line input control) | |
Defined The label of the element, usually the input title | |
defines a group of related form elements and uses an outer frame to enclose them | |
Defines the title of the | |
Define the drop-down option list | |
Define the option group | |
Define the options in the drop-down list | |
Define a click button | |
Specifies a predefined input control option list | |
Defines the key pair generator field of the form | |
Define a calculation result |
Extended information: element
element is the most important form element.
Elements have many forms, according to different type attributes.
1. Text Fields
The text field is set through the tag. When the user wants to type letters, numbers, etc. in the form , the text field will be used.
<form> First name: <input type="text" name="firstname"><br> Last name: <input type="text" name="lastname"> </form>
The browser displays the following:
Note: The form itself is not visible. Also, in most browsers, the default width of a text field is 20 characters.
2. Password field
The password field is defined by the tag :
<form> Password: <input type="password" name="pwd"> </form>
The browser display effect is as follows:
Note: Password field characters will not be displayed in plain text, but will be replaced by asterisks or dots.
3. Radio Buttons
tag defines the form radio button options
<form> <input type="radio" name="sex" value="male">Male<br> <input type="radio" name="sex" value="female">Female </form>
Browser display effect As follows:
4. Checkboxes
defines the checkbox. Users need to start from Select one or several options from a number of given choices.
<form> <input type="checkbox" name="vehicle" value="Bike">I have a bike<br> <input type="checkbox" name="vehicle" value="Car">I have a car </form>
The browser display effect is as follows:
5. Submit Button
Defines the submit button.
When the user clicks the confirm button, the content of the form will be transferred to another file. The form's action attribute defines the file name of the destination file. The file defined by the action attribute usually performs related processing on the input data received. :
<form name="input" action="html_form_action.php" method="get"> Username: <input type="text" name="user"> <input type="submit" value="Submit"> </form>
The browser display effect is as follows:
If you type a few letters in the text box above and click the confirm button, then enter the data The page that will be sent to "html_form_action.php". This page will display the entered results.
Recommended tutorial: "html video tutorial"
The above is the detailed content of What are the tags in html forms. For more information, please follow other related articles on the PHP Chinese website!