HTML Form is an interface that allows users to enter and submit data on a web page. It contains: input fields (text, password, email, number, checkbox, radio button), selector (dropdown menu) and buttons (submit, reset). Forms are created using the <form> element, with name, action, and method attributes. After the user enters data and submits it, the form data is sent to the specified URL via an HTTP request.
Usage of HTML Form
What is HTML Form?
HTML Form, a web form, is an interface through which users can enter and submit data on a web page. It usually contains input fields, selectors, and buttons that allow users to interact with the website.
Create HTML Form
To create an HTML Form, you can use the <form>
element:
<code class="html"><form> <!-- 输入字段、选择器和按钮 --> </form></code>
Input field
The input field is used to collect data entered by the user. It has the following types:
<input type="text">
: Single line text input<input type="password">
: Password protected single line text input<input type=" email">
: Email address input<input type="number">
: Number input<input type ="checkbox">
:checkbox<input type="radio">
:radio button# #Selector
Selector allows the user to select a value from a list of options, including:button
button is used to submit or reset the form, There are the following types:Other attributes
<form>Elements can use the following attributes:
: Assign a name to the form
: Specify the URL to which the data will be sent after the form is submitted
: Specify the HTTP method to send data to the server, which may be "get" or "post"
Created using HTML Form
Once the form is complete, the user can enter data in the input fields, select options in the selector, and click the submit button. The form data will be sent to the specified URL via an HTTP request.The above is the detailed content of Usage of form in html. For more information, please follow other related articles on the PHP Chinese website!