Table of Contents
html5 form tag
Control label:
input tag
密码框
单选框
复选框
按钮
下拉框标签
Home Web Front-end Front-end Q&A What is the use of the from tag in html

What is the use of the from tag in html

Sep 15, 2022 pm 05:36 PM
html from

In HTML, the from tag is used to create an HTML form (form field) for user input to collect and transfer user information. All content in the form will be submitted to the server; the syntax "Form control". A form can contain one or more form elements, such as input, select, and textarea.

What is the use of the from tag in html

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

html5 form tag

Function: The form tag is used to create an HTML form (form field) for user input to realize the collection and delivery of user information. In the form All content will be submitted to the server.

The form form field can contain various interactive controls - control labels (text fields, check boxes, radio boxes, submit buttons, etc.), such as , , < ; select>, and other tags.

Tag syntax format

1

2

3

<form action="提交地址" method="提交方式" name="表单名称">

  各种表单控件

</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, which is used to select the appropriate submission (transmission) method according to different data requirements

methodThe four commonly used submission methods:

1

2

3

4

get         一般用来查询信息

post        一般用来新增信息

put         一般用来修改信息

delete      一般用来删除信息

Copy after login

The difference between post and get:

  • Data submission method, get can see the submitted data URL, but post cannot see it

  • get is generally used For submitting a small amount of data, post is used to submit a large amount of data.

  • get can submit up to 1K data. Post has no limit in theory.

  • get can submit data In the browser history, security is not good

A complete form contains three basic components:Form tag, form field, form button.

1. Form tag

refers to the form tag itself, which is an area containing form elements, using the definition

2. Form field

is used to collect each item of user input in the tag. It is usually defined by the input tag. There are different types of input tags, corresponding to different user data. (For example: text field, drop-down list, radio button, check box, etc.)

3. Form button

is used to submit all the information in the form to the server

1

*表单域和表单按钮都属于表单元素。

Copy after login

Single line text box<input type="text" >The default value is type="text"

Password box<input type="password"/&gt ; 

Radio button<input type="radio" name=""/>

Check box<input type ="checkbox"/>

Hidden field<input type="hidden"/>

File upload<input type ="file"/>

Drop-down box<select>Label

Multi-line text<textarea></textarea>

Submit button<input type="submit"/>

Normal button<input type="button"/>

Reset button<input type="reset"/>

Control label:

input tag

  • The meaning of input
  • <input />The tag is a single tag
  • type attribute sets different attribute values ​​to specify different control types
  • In addition to the type attribute, there are other attributes

type="text" For the ordinary input box, the value is the value inside. The name and id will be used when writing js.

1

2

3

<form action="url地址" method="提交方式" name="表单名称">

    <input type="text" name="" id="" value="你好">

</form>

Copy after login

What is the use of the from tag in html

input tag Some attributes:

The checked attribute is only available for radio buttons and check boxes

属性属性值描述
typeText单行文本输入框

Password密码输入框

Radio单选按钮

Checkbox复选框

Button普通按钮

Submit提交按钮

Reset重置按钮

Image图像形式的提交按钮

File文本域
name
空间的名称
value
input控件中的默认文本值
size
input控件在页面中的显示宽度
checked
定义选择空间默认被选中的项
Maxlength
控件允许输入的最多字符数

密码框

1

<input type="password" name="" id="" value="">

Copy after login

What is the use of the from tag in html

单选框

name相同的单选框智能选择一个

1

2

男 <input type="radio" name="gender" id="" value="">

女 <input type="radio" name="gender" id="" value="">

Copy after login

What is the use of the from tag in html

复选框

多选框可以选取多个

1

2

3

4

爱好: <br>

抽烟<input type="checkbox" name="hobby" id="" value="">

喝酒<input type="checkbox" name="hobby" id="" value="">

烫头<input type="checkbox" name="hobby" id="" value="">

Copy after login

按钮

普通按钮可以根据需求来用js添加功能

提交按钮会把输入的表单信息提交到form表单的action地址

重置按钮会把表单信息重置为默认

1

2

3

4

5

<form action="url地址" method="提交方式" name="表单名称">

    <input type="button" name="" id="" value="我是一个普通按钮">

    <input type="submit" name="" id="" value="我是一个提交按钮">

    <input type="reset" name="" id="" value="我是一个重置按钮">

</form>

Copy after login

What is the use of the from tag in html

下拉框标签

下拉框标签有点特殊,不是input的属性而是一个单独的标签

1

2

3

4

5

6

7

<select name="省市区" id="">

    <option value="">山东</option>

    <option value="">北京</option>

    <option value="">江苏</option>

    <option value="">深圳</option>

    <option value="">上海</option>

</select>

Copy after login

What is the use of the from tag in html

(学习视频分享:web前端入门

The above is the detailed content of What is the use of the from tag in html. 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