This article mainly introduces the role and usage of form tags in HTML, as well as examples and definitions of form tags, so let's take a look at this article.
First, look at the definition of the form tag in HTML:
<form> tags are used to create HTML forms for user input.
A form can contain input elements such as text fields, checkboxes, radio boxes, submit buttons, and so on.
Forms can also contain menus, textarea, fieldset, legend, and label elements.
Forms are used to transfer data to the server.
Here is an example of a form tag:
<form action= "form_action.asp" method= "get" > <p> First user name: <input type= "text" name= "FName"/>< /p> <p> Second user name: <input type= "text" name= "lname"/></p> <input type= "Submit" value= "commit "/></form>
The effect looks at the picture:
Second, look at the role of HTML form tags explained:
The role of the form tag is to "package" other form labels so that as a whole, data can be submitted to the server.
HTML form Tags:
<form name= "form name" action= "Destination address" method= "data submission method" > ... </form>
Name: Just give the form a name for use with JS technology.
Action: Sets the file to which the form data is submitted for back-end technology (such as PHP) to accept and process the data
Method: Set the data submission method to select the appropriate submission (delivery) method according to different data requirements.
The function of the form label <form> form is to collect information
(1) Properties of form forms
<1>action= "url": a URL address that specifies where the form table sends data
<2>name: Set a name for the form
<3>enctype= "string": Specifies in what form the form data is encoded
<4>method= "Get/post": How to send data to the server
(2) Form elements: Form labels, form fields, form buttons
<1> form Labels: refers to the <form> label itself, using <form></form> definition
<2> form fields: is a <form> tag used to collect user input for each item, usually defined with the input tag, the input tag
There are different types of data that correspond to different users
<3> form buttons: Submit <form> All information in the form to the server
<4> FORM element types:
Single-line text box: <input type= "text", default value is type= "text"
Password box: <input type= "Password"/>
radio button: <input type= "Radio"/>
check box: <input type= "checkbox"/>
Hide box: <input type= "hidden"/>
File Upload: <input type= "File"/>
drop-down box:<select> label
Multi-line text:<textarea></textarea>
Element Set:<fieldset></fieldset>
Submit button: <input type= "Submit"/>
Normal button: <input type= "button"/>
Reset button: <input type= "Reset"/>
The above is the whole content of this article, what questions are welcome to ask questions below