What is the use of the from tag in html
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.
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.
1 2 3 |
|
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 |
|
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 |
|
Single line text box<input type="text" >The default value is type="text"
Password box<input type="password"/> ;
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 |
|
input tag Some attributes:
The checked attribute is only available for radio buttons and check boxes
属性 | 属性值 | 描述 |
---|---|---|
type | Text | 单行文本输入框 |
Password | 密码输入框 | |
Radio | 单选按钮 | |
Checkbox | 复选框 | |
Button | 普通按钮 | |
Submit | 提交按钮 | |
Reset | 重置按钮 | |
Image | 图像形式的提交按钮 | |
File | 文本域 | |
name | 空间的名称 | |
value | input控件中的默认文本值 | |
size | input控件在页面中的显示宽度 | |
checked | 定义选择空间默认被选中的项 | |
Maxlength | 控件允许输入的最多字符数 |
密码框
1 |
|
单选框
name相同的单选框智能选择一个
1 2 |
|
复选框
多选框可以选取多个
1 2 3 4 |
|
按钮
普通按钮可以根据需求来用js添加功能
提交按钮会把输入的表单信息提交到form表单的action地址
重置按钮会把表单信息重置为默认
1 2 3 4 5 |
|
下拉框标签
下拉框标签有点特殊,不是input的属性而是一个单独的标签
1 2 3 4 5 6 7 |
|
(学习视频分享: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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

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

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.

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

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

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

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

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

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