PHP development basic tutorial $_POST
1. $_POST variable
The predefined $_POST variable is used to collect values from the form with method="post".
Information sent from a form with the POST method is invisible to anyone (will not be displayed in the browser's address bar), and there is no limit on the amount of information sent.
Note: However, by default, the maximum amount of information sent by the POST method is 8 MB (can be changed by setting post_max_size in the php.ini file).
Change the previous example to POST submission
Example: The code is as follows
php中文网(php.cn)
大家好,我是 !
今年 岁。
The output is as shown on the right
The page submitted to is 3_2.php, the code is as follows
php.cn 大家好,我是 !
今年 岁。
Note: You can observe the address bar to see if there is a query string. This is the difference between GET and POST
2. When to use method="post"?
Information sent from a form with the POST method is not visible to anyone, and there is no limit on the amount of information sent.
However, since the variable does not appear in the URL, the page cannot be bookmarked.
3. PHP $_REQUEST variable
On the receiving page, in addition to using $_GET and $_POST to receive data , you can also use $_REQUEST to receive.
The predefined $_REQUEST variable contains the contents of $_GET, $_POST and $_COOKIE.
The previous two receiving statements can be combined into should. The code is as follows:
大家好,我是 !
今年 岁。
You can try it to see if it can be received normally