As mentioned above, it is very convenient to submit the form information in PHP. But how long is the lifecycle of the variable in the submitted form information? This article is here ?? Let's talk about this issue. The form parameters are passed to the next handler, which is unquestionable. Because we have had such an example. But it will continue to be passed to the next SyntaxHighlighter. all ();
As mentioned above, it is very convenient to submit the form information in PHP. But how long is the lifecycle of the variable in the submitted form information? This article is here ?? Let's talk about this issue. The form parameters are passed to the next handler, which is unquestionable. Because we have had such an example. But will it still be passed to the next handler?
The answer is No! The parameters submitted by a Form are only transmitted to the first handler, which does not work in the next handler. Let's take a look at the following example:
File: table.html
Form submission
File: deal-1.php
Echo"";
Echo "you like $ start, right?
";
Echo "try again ";
Echo"";
?>
File: deal-2.php
Echo"";
Echo "would you say $ start? ";
Echo"";
?>
From the above example, we can see that the result of deal-1.php processing is (we entered "Zhang Xueyou" in table.html): Do you like Zhang Xueyou, right?
Try again
Note the form commits the variable $ start to the deal-1.php, and in the display result of the deal-1.php, if we click the link "try again" after the deal-2.ph ?? The processing result of p is:
Do you say yes?
Obviously, $ start is not passed to deal-2.php. But how can we extend the lifecycle of $ start? In fact, this is very simple, just use the parameter transfer method. Such ?? We can change the deal-1.php to this:
Echo"";
Echo "you like $ start, right? Lt; br> ";
Echo "try again ";
Echo"";
?>
Minute program, you will find that just added a sentence after the deal-1.php "? Start = $ start ", and the role of this operation is parameter transfer. Such as: http://zhuagk12.oso .?? Com.cn/cartoon.php? No = 1 its? And no is the parameter name. The value is 1. In this way, $ no is generated in the cartoon. php program, and its value is 1. If two or more ?? Parameters, which are separated. Such as: http://zhuagk12.oso.com.cn/cartoon.php? No = 2 & debug = 1
We can also use cookies or sessions to extend the lifecycle of parameters. we will not describe them here. you will see their usage in future articles.