PHP study notes (2 ). PHP $ _ GET and $ _ POST are used to retrieve values in the form, such as user input. Form instance: htmlbodyformactionwelcome. phpmethodpostName: inputtypetextnamenameAge: $ _ GET and $ _ POST in PHP are used to retrieve values in the form, such as user input.
Form instance:
When the user fills in the form and submits the button, the form data will be sent to the "welconme. php" file.
The "welcome. php" file is similar to the following:
Welcome .
You are Years old.
$ _ GET is an array with the variable name and value sent by the http get method.
The $ _ GET variable is used to collect the values in the form from method = "get. The information sent from a form with the GET method is visible to anyone (displayed in the address bar of the browser), and the amount of information sent is limited (up to 100 characters ).
The "welcome. php" file can now GET form data using the $ _ GET variable, and the name of the form field will automatically become the ID key in the $ _ GET array:
Note: When $ _ GET is used, all variable names and values are displayed in the URL. Therefore, this method should not be used when sending passwords or other sensitive information. However, because the variables are displayed in the URL, you can add the page to favorites. In some cases, this is useful.
The http get method is not suitable for large variable values. The value cannot exceed 100 characters.
The $ _ REQUEST variable in PHP contains $ _ GET, $ _ POST, and $ _ COOKIE content.
The $ _ REQUEST variable of PHP can be used to obtain the results of form data sent through the GET and POST methods.
The $ _ POST variable is used to collect the values in the form from method = "post. The information sent from a form with the POST method is invisible to anyone (not displayed in the address bar of the browser) and there is no limit on the amount of information sent.
The $ _ GET and $ _ POST of the http://www.bkjia.com/PHPjc/477949.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/477949.htmlTechArticlePHP are used to retrieve values in the form, such as user input. Form example: html body form action = welcome. php method = post Name: input type = text name = name/Age: in...