What does $_post mean in php

藏色散人
Release: 2023-03-06 18:22:01
Original
6630 people have browsed it

$_post in php refers to the predefined $_POST variable, which is used to collect values ​​from the form with "method="post""; the information sent from the form with the POST method is valid for any People are invisible, and there are no limits on how much messages can be sent.

What does $_post mean in php

Recommended: "PHP Video Tutorial"

In PHP, the predefined $_POST variable is used to collect Value 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).

Example

form.html file code is as follows:

<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>
<form action="welcome.php" method="post">
名字: <input type="text" name="fname">
年龄: <input type="text" name="age">
<input type="submit" value="提交">
</form>
</body>
</html>
Copy after login

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

http://www.runoob.com/welcome.php
Copy after login

" welcome.php" file can now collect form data via the $_POST variable (note that the names of the form fields automatically become keys in the $_POST array):

欢迎 <?php echo $_POST["fname"]; ?>!<br>
你的年龄是 <?php echo $_POST["age"]; ?>  岁。
Copy after login

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:
php
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template