What is the function of form tag in HTML? Explanation of usage of HTML form tag

寻∝梦
Release: 2018-08-29 16:58:27
Original
31391 people have browsed it

This article mainly introduces the function and usage of the form tag in HTML, as well as the examples and definitions of the form tag. Next, let us take a look at this article.

1. Let’s first look at the definition of the form tag in HTML:

tag is used to create HTML forms for user input.

Forms can contain input elements, such as text fields, check boxes, radio buttons, submit buttons, etc.

Forms can also contain menus, textarea, fieldset, legend and label elements.

Forms are used to transmit data to the server.

Here are examples of form tags:

<form action="form_action.asp" method="get">
  <p>第一个用户名: <input type="text" name="fname" /></p>
  <p>第二个用户名: <input type="text" name="lname" /></p>
  <input type="Submit" value="提交" />
</form>
Copy after login

Effect picture:

What is the function of form tag in HTML? Explanation of usage of HTML form tag

二, look at the explanation of the role of the HTML form tag:

The form tag is used to "wrap" other form tags so that as a whole, data can be submitted to the server.

html form tag format:

<form  name="表单名称"  action="目标地址"  method="数据提交方式" >  。。。 </form>
Copy after login

name: Just name the form, used for js technology.

action: Set which file the form data is submitted to, used for back-end technology (such as php) to accept and process the data

method: Set the data submission method, used for different Data requirements to choose the appropriate submission (transmission) method

3. Form tag The function of the form is to collect information

(1) form Attributes of the form

action="URL": A URL address, specifying where the form will send data

name: Set a name for the form Name

enctype="string": Specifies the form in which the form data is encoded

method="get/post": How to send it to the server Data

(2) Form elements: form labels, form fields, form buttons

Form labels: refers to the

label itself, use < ;form>
Definition

Form field: It is used to collect each item input by the user in the

tag. It is usually defined with the input tag, input tag

There are different types, corresponding to different user data

Form button: Submit all the information in the

form to the server

Types of form elements :

  • Single-line text box: , the default value is type="text"

  • Password box :

  • Radio button:

  • Check box:

  • Hidden box:

  • File upload:

  • Drop-down box:

  • Multi-line text:

  • Label:

  • Element set :

  • Submit button:

  • Normal button :

  • Reset button:

The above is the entire content of this article. If you have any questions, please ask below

[Editor’s recommendation]

How to use HTML div tags? Here are examples of how to use div

How to wrap the text in the pre tag in html? Usage examples of html pre tag

The above is the detailed content of What is the function of form tag in HTML? Explanation of usage of HTML form tag. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template