Get the App
SLTechnology News&Howtos  ›  Development  › 

Case Analysis of input method of HTML form

Shulou Source: shulou.com Published: 2022-06-01 15:53:48 10月16日 Update

Today, I would like to share with you the HTML form input method example analysis of the relevant knowledge points, detailed content, clear logic, I believe that most people are too aware of this knowledge, so share this article for your reference, I hope you will get something after reading this article, let's take a look at it.

HTML form

A form is an area that contains form elements.

Form elements allow users to enter content in the form, such as text fields (textarea), drop-down lists, radio-buttons boxes, checkboxes, and so on. Forms use form tags

To set the: .input element.

HTML form-input element

In most cases, the form tag used is the input tag ().

The input type is defined by the type type. Most of the frequently used input types are as follows:

Text field (Text Fields)

Text fields are set by labels, and are used when users type letters, numbers, and so on into the form.

First name:type= "text" name= "firstname" >

Last name:type= "text" name= "lastname" >

The browser displays as follows:

First name: Last name:

Note: the form itself is not visible. Also, in most browsers, the default width of the text field is 20 characters.

Password field

Password fields are defined by labels:

Password:type= "password" name= "pwd" >

The browser displays as follows:

Password:

Radio button (Radio Buttons)

The tag defines the form radio check box option

Type= "radio" name= "sex" value= "male" > Male

Type= "radio" name= "sex" value= "female" > Female

The browser displays as follows:

Male Female

Check box (Checkboxes)

A check box is defined. The user needs to select one or more options from several given selections.

Type= "checkbox" name= "vehicle" value= "Bike" > I have a bike

Type= "checkbox" name= "vehicle" value= "Car" > I have a car

The browser displays as follows:

I have a bike I have a car

Submit button (Submit Button)

The submit button is defined.

When the user clicks the confirm button, the contents of the form are transferred to another file. The action attribute of the form defines the file name of the destination file. This file, defined by the action attribute, usually processes the input data received:

"input" action= "html_form_action.php" method= "get" > Username:type= "text" name= "user" > type= "submit" value= "Submit" >

The browser displays as follows:

Username:

If you type a few letters in the text box above and then click the confirm button, the input data will be transferred to the "html_form_action.php" page. The page displays the results of the input.

The above is all the content of this article "HTML form input method example Analysis". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: Forms inputs tags browsers browsing content buttons fields elements effects files users knowledge articles attributes types check boxes examples case analysis methods Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Apple Shulou Information OPPO Reno Xiaomi