HTML form
What is a form
##The form is to collect different types of user input, such as:
- Website registration
- Login
- Post resume
- Forum post
- Reply S vote etc
##HTML Form
A form is an area containing form elements. A web page may have multiple forms, but a form corresponds to a form area, and can only submit the form items of the current form area.
The form element allows the user to enter content in the form, such as: text area (textarea) , drop-down lists, radio-buttons, checkboxes, etc.
The form uses the form tag
actionis used to configure where the form data is sent for processing. It is usually the address of a dynamic script, such as the address of a PHP file. login.php
methodcan be GET or POST (if not set, the system defaults to GET, but in most cases We use POST and GET to submit in the form of parameters. Users can directly see the submitted parameters. Post uses the HTTP post mechanism to place each field in the form and its content in the HTML HEADER and transmit it to the URL address pointed to by the ACTION attribute. Can't see this process)
##HTML Form - Input Element
Text field
The text field is set through the tag. When the user types letters, numbers, etc. in the form, the text field is used.
Example
php中文网(php.cn)
The browser displays the following:
Password field
##The password field is defined by the tag :
The browser displays as follows:php中文网(php.cn)
Note: Password field characters will not be displayed in plain text, but will be replaced by asterisks or dots.
Radio button
## tag defines the form radio button Options
The browser displays the following:php中文网(php.cn)
Checkbox
defines a checkbox. The user needs to select from a number of given Select one or several options from the selection.
php中文网(php.cn) 自行车 汽车 飞机 轮船
The browser displays as follows:
##Submit button
defines the submit button. When the user clicks the confirm button, the content of the form will be transferred to another file. The form's action attribute defines the file name of the destination file. The file defined by the action attribute usually performs related processing on the input data received. :The browser displays as follows: #If you type a few letters in the text box above and then click the confirm button, the input data will Sent to the "action.php" page as a post. This page will display the entered results.php中文网(php.cn)
HTML form tag
Tags | Description |
Define the form for user input | |
Define the input field | |
Define the text area (a multi-line input control) | |
Defines the label of the element, usually the input title |
Defines a set of related form elements and uses an outer frame to enclose them | |
< ;legend> | Defines the title of the |
Defines the drop-down option list | |
Define the option group | |
To learn more about HTML form tags, visit our HTML Reference Manual
For more examples
This example demonstrates how to create a simple drop-down list box in an HTML page. The drop-down list box is a selectable list. Dropdown list with preselected values.
php中文网(php.cn)
Program running result:
This example demonstrates how to create a text field (multiple line text input control). The user can write text in the text field. An unlimited number of characters can be written, as well as a button. You can customize the text on the button.
php中文网(php.cn)
Program running result:
##Form instance
Example
- Course Recommendations
- Courseware download
-
IntermediateFront-end Vue3 actual combat [handwritten vue project]
2857 people are watching -
ElementaryAPIPOST tutorial [Popularization of technical concepts related to network communication]
1795 people are watching -
IntermediateIssue 22_Comprehensive actual combat
5521 people are watching -
ElementaryIssue 22_PHP Programming
5172 people are watching -
ElementaryIssue 22_Front-end development
8713 people are watching -
IntermediateBig data (MySQL) video tutorial full version
4525 people are watching -
ElementaryGo language tutorial-full of practical information and no nonsense
2794 people are watching -
ElementaryGO Language Core Programming Course
2814 people are watching -
IntermediateJS advanced and BootStrap learning
2563 people are watching -
IntermediateSQL optimization and troubleshooting (MySQL version)
3374 people are watching -
IntermediateRedis+MySQL database interview tutorial
2963 people are watching -
ElementaryDeliver food or learn programming?
5708 people are watching
Students who have watched this course are also learning
- Let's briefly talk about starting a business in PHP
- Quick introduction to web front-end development
- Large-scale practical Tianlongbabu development of Mini version MVC framework imitating the encyclopedia website of embarrassing things
- Getting Started with PHP Practical Development: PHP Quick Creation [Small Business Forum]
- Login verification and classic message board
- Computer network knowledge collection
- Quick Start Node.JS Full Version
- The front-end course that understands you best: HTML5/CSS3/ES6/NPM/Vue/...[Original]
- Write your own PHP MVC framework (40 chapters in depth/big details/must read for newbies to advance)
- About us Disclaimer Sitemap
- php.cn:Public welfare online PHP training,Help PHP learners grow quickly!