Home Web Front-end HTML Tutorial What is the function of form tag in HTML? Explanation of usage of HTML form tag

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

Aug 29, 2018 pm 04:58 PM
form html

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

HTML Input Placeholder HTML Input Placeholder Sep 04, 2024 pm 04:54 PM

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Moving Text in HTML Moving Text in HTML Sep 04, 2024 pm 04:45 PM

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

See all articles