What does _post mean in php

藏色散人
Release: 2023-03-08 22:48:01
Original
3325 people have browsed it

_post in php refers to the "$_POST" variable. In PHP, this variable is used to collect values from the form with "method='post'"; information sent from the form with the POST method , is invisible to anyone, and there is no limit on the amount of messages you can send.

What does _post mean in php

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

PHP $_POST variable

In PHP, 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 (it does not appear in the browser's address bar), and there is no limit on the amount of information sent.

In PHP, the predefined $_POST variable is used to collect values from the form with method="post".

$_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).

[Recommended learning:PHP video tutorial]

Example

form.html file code is as follows:

   php中文网(php.cn) 
名字: 年龄:
Copy after login

When the user clicks the "Submit" button, the URL will be similar to the following:

//m.sbmmt.com/welcome.php

"welcome.php" file now Form data can now be collected through the $_POST variable (please note that the names of the form fields will automatically become keys in the $_POST array):

Welcome !

Your age is years.

Access the demonstration through the browser as follows:

What does _post mean in php

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.

PHP $_REQUEST variable

The predefined $_REQUEST variable contains the contents of $_GET, $_POST and $_COOKIE.

$_REQUEST variable can be used to collect form data sent via GET and POST methods.

Example

You can modify the "welcome.php" file to the following code, which can accept $_GET, $_POST and other data.

Welcome !

Your age is Years old.

The above is the detailed content of What does _post mean in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!