Home >Web Front-end >HTML Tutorial >Usage of form in html

Usage of form in html

下次还敢
下次还敢Original
2024-04-27 19:46:181045browse

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

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 form in html

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></form> element:

<form>
  <!-- 输入字段、选择器和按钮 -->
</form>

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

Elements can use the following attributes:
  • name: Assign a name to the form
  • action: Specify the URL to which the data will be sent after the form is submitted
  • method: 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn