form element"; the form tag pair can contain a variety of form elements, such as input , textarea, select, option, button, etc."/> form element"; the form tag pair can contain a variety of form elements, such as input , textarea, select, option, button, etc.">

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

what does form mean in html

青灯夜游
青灯夜游Original
2021-11-18 11:41:3214423browse

Form means "form" in HTML. It is a tag that creates an HTML form for user input. The syntax format is "ff9c23ada1bcecdd1a0fb5d5a0f18437form elementf5a47148e367a6035fd7a2faa965022e"; 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 ff9c23ada1bcecdd1a0fb5d5a0f18437 tag, where form objects such as form fields, buttons, and other things are placed:

<form>
....
表单元素
....
</form>

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>

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>

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: 4750256ae76b6b9d804861d8f69e79d340587128eee8df8f03d0b607fe983014

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!

Statement:
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