During the development of our web site, we typically encounter actions related to the form of a PHP form. If PHP gets the form data with the post submission method, how does this work? If you have seen me "How does php get form form data by Get method?" "In this article, I believe you have a certain understanding of the method of getting form data for PHP $_get[] variables.
Then this article continues to give you a detailed introduction, how PHP through the Post method to obtain form form data.
The following is a specific code example:
1. Form form code (POST method Submission Form example):
Accessed through a browser, such as:
For example, we enter the name and age click Submit to the test.php file.
2. The test.php code is as follows (PHP gets post data):
<?phpheader ("Content-type:text/html;charset=utf-8"); Set the encoding?> welcome <?php echo $_post["fname"];?>!<br> you are <?php echo $_post["age";?> years old.
Here we get form form data i.e. fname and age parameters via PHP $_post[] variables (refer to the second chapter of PHP 0 basic Getting Started Tutorial: PHP form), post-submission browser access results such as:
Notice here that no form form parameter appears in the link in the browser's address bar. That is, PHP gets the form information submitted by the Post method is completely not displayed in the Address bar. In Web Form design, most of the use of the post submission method, because it is more than the security of the Get method to submit the form is much higher, to avoid the leakage of sensitive information, and post send the amount of information is not limited. However, the page cannot be bookmarked because the variable is not displayed in the URL.
The above is about how PHP gets the post submission form data in a specific way. Have a certain reference value, hope to have a friend in need to help.