In the php Tutorial, there are many methods to obtain parameters transmitted from the form and url. Next we will introduce the code principles and methods for obtaining the submitted form from $ _ post and $ _ request.
$ _ Post: it can only receive data when php obtains the method = "post" of the form. The following code
<Form id = "form1" name = "form1" method = "get" action = "">
<Input type = "text" name = "cn" value = 'get me'/>
A. php page
If ($ _ post)
Echo $ _ post ['cn'];
Echo 'no value obtained ';
The value obtained is get me. If we get the method = "get" of the form, we need to get it with $ _ get, as shown below:
Echo $ _ get ['cn']; // This is also a value.
How can we use $ _ request?
Echo $ _ request ['cn'];
// No matter whether your form's method is get or post or a value passed from the url parameter, you can get it.
So what are the differences between them? According to my summary, $ _ post and $ _ get are efficient to $ _ request. I will understand the difference after a careful consideration, because the first two are targeted, naturally, do not judge whether they are post or get data. For page $ _ request, he must judge that the submitted data is in that form, this takes some time.
Note: This site Original tutorial reprint indicate source http://www.111cn.nethttp: // www.111cn.net/phper/php.html