WEB forms provide a platform for interactions between visitors and websites. WEB forms are mainly used to send data to the server on a webpage. for example, you need to use a form when submitting registration information.
What is a form?
WEB forms provide a platform for interactions between visitors and websites. WEB forms are mainly used to send data to the server on a webpage. for example, you need to use a form when submitting registration information. After entering the information, the user submits the form (submit), which transfers the form content from the browser of the client to the server. after the form content is processed by the PHP program on the server, then, pass the information required by the user back to the browser of the client. PHP interacts with WEB forms by obtaining various information submitted by users.
Since we have mentioned Web development, we have to mention HTML. HTML, as a standard language designed for front-end Web user interfaces, must be understood and applied by developers, especially HTML forms, it is particularly important.
Form and HTML markup language
HTML is a world-class hypertext markup language. HTML can be used to implement multiple elements such as images, links, music, and programs. Nowadays, it is a basic task for programmers.
Form is the most common component in WEB applications. it consists of the submit button and other related components. forms are used in many fields for user registration, logon, online shopping, banking, and other functions.
Create form
Use
To create a form. The form structure is as follows:
// Insert some form elements
The tag attributes are as follows:
Tag attributes |
Description |
Name |
Form Name |
Method |
Set the form submission method, GET or POST method |
Action |
Point to the URL (relative or absolute path) for processing the form page) |
Enctype |
Set the form content encoding method |
Target |
Sets the display mode of returned information. the attribute values of target are described below. |
The target property value is as follows:
Attribute value |
Description |
_ Blank |
Display the returned information in a new window |
_ Parent |
Display the returned information in the parent window |
_ Self |
Display the returned information in the current window |
_ Top |
Display the returned information in the top-level window |
Note: The GET () method is to append the form content to the end of the URL address, and the POST () method is to send the information in the form as a data block to the processing program on the server, the submitted information is not displayed in the address bar of the browser. The default method of the method attribute is GET ().
For example, create a form and submit it to check. php on the data processing page using the POST () method. the code is shown as follows:
// Insert some form elements
Note: The above code isTag attributes are the most basic usage method. Note that when using a form, you must specify its behavior attribute action, which specifies that the content of the form is sent to the combination for processing at the time of submission.
What are the details of creating PHP forms and forms? for more information, see other related articles in the first PHP community!