Home > Backend Development > PHP Tutorial > PHP study notes (2)_PHP tutorial

PHP study notes (2)_PHP tutorial

WBOY
Release: 2016-07-13 17:54:18
Original
1041 people have browsed it

PHP’s $_GET and $_POST are used to retrieve values ​​in forms, such as user input.
Form example:



Name:
Age:




When the user fills out the form and submits the button, the form data will be sent to the "welconme.php" file
The "welcome.php" file looks like this:


Welcome .

You are years old.

The $_GET variable is an array whose content is the variable name and value sent by the HTTP GET method
The $_GET variable is used to collect values ​​from the form with method="get". Information sent from a form with the GET method is visible to everyone (displayed in the browser's address bar), and there is a limit on the amount of information sent (maximum 100 characters).
The "welcome.php" file can now retrieve form data via the $_GET variable and the name of the form field will automatically become the ID key in the $_GET array:
Note: When using $_GET variables, all variable names and values ​​will appear in the URL. So this method should not be used when sending passwords or other sensitive information. However, because the variables appear in the URL, you can bookmark the page. In some cases this is useful.
The HTTP GET method is not suitable for large variable values; values ​​cannot exceed 100 characters.
PHP's $_REQUEST variable contains the contents of $_GET, $_POST and $_COOKIE.
PHP's $_REQUEST variable can be used to obtain the results of form data sent via GET and POST methods.
The $_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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477949.htmlTechArticlePHP’s $_GET and $_POST are used to retrieve values ​​in forms, such as user input. Form example: html body form action=welcome.php method=post Name: input type=text name=name / Age: in...
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