Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use form tags in html

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use html form tags, the text is very detailed, has a certain reference value, interested friends must read!

4-1

A form can send data entered by the viewer to the server so that the server-side program can process the data passed by the form.

Grammar:

Explanation:

1. : Labels appear in pairs, beginning with and ending with.

2. action: The place to which the data entered by the viewer is sent, such as a PHP page (save.php).

3. Method: The method of data transmission (get/post).

4-2

input box

Text input box, password input box

Text input boxes are used when users want to type letters, numbers, etc. into a form. Text boxes can also be converted into password entry boxes.

Grammar:

1、type:

When type="text", the input box is a text input box;

When type="password", the input box is a password input box.

2, name: name the text box for background programs ASP, PHP use.

3. value: Set the default value for the text input box. (usually used as a reminder)

4-3

Text field, supports multi-line text input

Text input fields are needed when users need to enter large blocks of text in a form.

Grammar:

text

Labels appear in pairs, beginning with and ending with.

Cols: The number of columns in a multi-row input field.

3. rows: the number of rows in a multi-row input field.

4-4

radio box, check box

Grammar:

1、type:

When type="radio", the control is a radio box

When type="checkbox", control is checkbox

2. value: the value of submitting data to the server (used by PHP daemon)

3. name: name the control for background programs ASP and PHP

4. Checked: When checked="checked" is set, this option is selected by default.

Note: The radio buttons of the same group must have the same name value, so that the radio buttons of the same group can play the role of radio.

4-5

Drop-down list box to save space

Drop-down lists are also commonly used in web pages, which can effectively save web space. You can choose one or more.

Syntax: Options

Commit value is the value submitted to the server and option is the value displayed.

Hobbies:

reading

tourism

motion

shopping

4-6

Use the drop-down list box for multiple selection

Dropdown list can also be multiple-choice operation, in the label set multiple="multiple" attribute,

You can realize the multi-choice function, press Ctrl key and click at the same time to select multiple options.

The code is as follows:

Hobbies:

reading

tourism

motion

shopping

4-7

There are two types of buttons available in the form: Submit button and Reset button.

1. Submit button: When users need to submit form information to the server, they need to use the submit button.

Grammar:

type: only when the type value is set to submit, the button has a submit function

value: text displayed on the button

2, Reset button, reset form information

When the user needs to reset the form information to the initial state, for example, after the user inputs "user name" and finds that the writing is wrong, he can use the reset button to restore the input box to the initial state. Just set the type to "reset."

Grammar:

type: The button has reset effect only when the type value is set to reset

value: text displayed on the button

The above is "html form tag how to use" all the content of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report