Home > Web Front-end > Front-end Q&A > what does form mean in html

what does form mean in html

青灯夜游
Release: 2021-11-18 11:41:32
Original
14410 people have browsed it

Form means "form" in HTML. It is a tag that creates an HTML form for user input. The syntax format is "

form element
"; the form tag can be aligned Contains a variety of form elements, such as input, textarea, select, option, button, etc.

what does form mean in html

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

Form means "form" in HTML. It is a tag that creates an HTML form for user input.

A form is an area containing form elements; function: used to collect different types of user input.

Form elements allow users to enter content in the form, such as text areas, drop-down lists, radio-buttons, checkboxes, etc.

Forms are created through the

tag, where form objects such as form fields, buttons, and other things are placed:

<form>
....
表单元素
....
</form>
Copy after login

Commonly used form elements

ü form form

ü input form element, form item

ü select and option drop-down menu

ü textarea text area

(1)form element

Function: used to create a form

Format:

<form></form>
Copy after login

Basic usage:



Important attributes:

1, action: Indicates which page the content in the current form is submitted to for processing

2, method: indicates the current form submission method, the common methods are get and post, the default is get submission

(2) input element

Represents an input box, which comes in many forms. You can determine which input box to display based on the type attribute.


Basic usage:


##Effect:



Attention to details:

1, for input, the default value of its type is text, which represents a single line of text

2 , for input, it is best to add a name attribute to it, which is used to submit the content entered by the user to the page where the data is to be processed

GET submission and POST submission:

GET:


If you submit in get mode but do not write the name attribute, then the content entered by the user cannot be submitted, but will it still appear? This sign:


POST:

When the user submits in post mode, the content entered by the user will not be placed in the address bar. Compare Security:


Summary of GET and POST:

1. GET will put the content entered by the user into the address bar. Using GET request will not Security

2, POST will not put the content entered by the user into the address bar, relatively safe

Details:

1, Each input tag has a value attribute , different types of input, the role of value is also different

For type="text", value is dispensable, because all the content input by the user can be submitted.

For type="radio" or type="checkbox", if there is no value, it cannot be submitted.


2. For type="radio", if you only want to select one, you need to add a name attribute to each input, and the attribute value must also be Consistent, if it is not added, it cannot meet the needs of the radio button.

3. Regarding the width of a single line of text, you can use the size attribute to set it, indicating the character length. In fact, it is not used. We generally control it through CSS.

(3) select and option

Function: used to implement drop-down list

Format:

<select>
<option>内容</option>
<option>内容</option>
<option>内容</option>
</select>
Copy after login
Basic usage:


Note:


#1. By default, when submitting, the content in the option will be used as the submitted content, but Usually we don't do this. We usually set a value attribute for opton, and we usually use numbers for the attribute value.

The situation after using value is as follows:


We can use the selected attribute to let an option handle the default selected state.


(3) textarea

Function: Provides an input box for inputting large amounts of text, for example, publishing in QQ space Status, Tieba posts, etc.

Format: <textarea></textarea>

Basic usage:


## Recommended tutorial: "

html video tutorial"

The above is the detailed content of what does form mean in html. 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