Detailed description of the data submission instance in the php receiving form. In php, there are several forms to submit data. one is post and get. next I will introduce php beginners in detail how to use get and post to receive data submitted by forms, there are several forms to submit data in php. one is post and get. next I will introduce php beginners in detail using get, post is used to receive the data submitted by forms. For more information, see.
PHP $ _ GET and $ _ POST variables are used to obtain information in the form, such as user input information.
PHP4.1 (like) cancels the direct receipt of variables, and uses $ _ GET ['variable name'] to receive the variables passed from the link, use $ _ POST ['variable name'] to receive the variables submitted from the form. There are also $ _ FILES [], $ _ SERVER [], etc.
The following is an HTML file. This HTML contains an HTML Form, which is mainly used for users to enter their names.
The HTML display interface is as follows:
When you enter a name in the form text box of this HTML file, such as "Jacky", and then click the OK button, it will jump to get. php, as shown in get. php.
The source code of get. php is as follows:
The code is as follows: |
|
. |
Obtain the data of the form control by taking the name value of the form control.
For example, "username" is the name value of the text input box of the form control,
You can use $ _ GET ["username"] to obtain the data in the text input box.
Obtain HTML Form (HTML Form) single dataset (input type = "radio") data
You can obtain the value of the single-sheet signature by taking the name value of the single-sheet signature.
$ _ POST: get HTML form submission data
The following is an HTML file. This HTML contains an HTML Form, which is mainly used for users to input user names.
When You enter a name in the text box of the HTML Form, such as "Jacky", and then click OK, the page will jump to post. php. the output result is You are Jacky .. The source code of post. php is as follows:
The code is as follows: |
|
You are .
|
Obtain the data of the form control by taking the name value of the form control.
For example, "username" is the name value of the text input box of the form control,
You can use $ _ POST ["username"] to obtain the data in the text input box.
$ _ REQUEST variable
The PHP $ _ REQUEST variable contains $ _ GET, $ _ POST, and $ _ COOKIE content.
The PHP $ _ REQUEST variable can be used to obtain the form data sent through the "GET" and "POST" methods.
Case
The code is as follows: |
|
Welcome .
You are Years old |
...