PHPform parameter details. Why? Because there are two types of form processing: GET and POST, how to pass the do parameter in both forms, in addition, it is always confusing to obtain data in the same way in the background. why? Because there are two types of form processing: GET and POST, how to pass the do parameter in both forms, in addition, it has always been a confusing issue to obtain data in the same way in the background. after several hours of experimentation, I finally understood this article.
GET form:
The code is as follows:
Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
Use GET to pass values in a form
PHP for processing GET forms:
The code is as follows:
Echo "the value of the parameter name is obtained through \ $ _ GET as". $ _ GET ["name"]. ",";
Echo "the value of the parameter name is obtained through \ $ _ POST as". $ _ POST ["name"]. ",";
Echo "the value of the parameter name is obtained through \ $ _ REQUEST as". $ _ REQUEST ["name"]. ". \ r \ n ";
Echo "the value of parm is obtained through \ $ _ GET as". $ _ GET ["parm"]. ",";
Echo "the value of parm is obtained through \ $ _ POST as". $ _ POST ["parm"]. ",";
Echo "the value of parm is obtained through \ $ _ REQUEST as". $ _ REQUEST ["parm"]. ". \ r \ n ";
Echo "the hkey value is obtained through \ $ _ GET as". $ _ GET ["hkey"]. ",";
Echo "the value of the hkey parameter is obtained through \ $ _ POST as". $ _ POST ["hkey"]. ",";
Echo "the value of the hkey parameter is obtained through \ $ _ REQUEST as". $ _ REQUEST ["hkey"]. ". \ r \ n ";
Echo "the do value of the parameter is obtained as". $ _ GET ["do"]. ",";
Echo "the do value of the parameter is obtained as". $ _ POST ["do"]. ",";
Echo "the do value of the parameter is obtained through \ $ _ REQUEST as". $ _ REQUEST ["do"]. ". \ r \ n ";
?>
Processing result output:
The value of the parameter name is obtained as kj through $ _ GET, the value of the parameter name is obtained through $ _ POST, and the value of the parameter name is obtained as kj through $ _ REQUEST.
The value of parm is obtained through $ _ GET, the value of parm is obtained through $ _ POST, and the value of parm is obtained through $ _ REQUEST.
The hkey value is obtained as hvalue through $ _ GET. the hkey value is obtained through $ _ POST, and the hkey value is obtained as hvalue through $ _ REQUEST.
The do value of the parameter is obtained as index through $ _ GET, the do value of the parameter is obtained through $ _ POST, and the do value of the parameter is obtained as index through $ _ REQUEST.
POST form:
The code is as follows:
Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
The form uses POST to pass values.
PHP for processing POST forms:
The code is as follows:
Echo "the value of the parameter name is obtained through \ $ _ GET as". $ _ GET ["name"]. ",";
Echo "the value of the parameter name is obtained through \ $ _ POST as". $ _ POST ["name"]. ",";
Echo "the value of the parameter name is obtained through \ $ _ REQUEST as". $ _ REQUEST ["name"]. ". \ r \ n ";
Echo "the value of parm is obtained through \ $ _ GET as". $ _ GET ["parm"]. ",";
Echo "the value of parm is obtained through \ $ _ POST as". $ _ POST ["parm"]. ",";
Echo "the value of parm is obtained through \ $ _ REQUEST as". $ _ REQUEST ["parm"]. ". \ r \ n ";
Echo "the hkey value is obtained through \ $ _ GET as". $ _ GET ["hkey"]. ",";
Echo "the value of the hkey parameter is obtained through \ $ _ POST as". $ _ POST ["hkey"]. ",";
Echo "the value of the hkey parameter is obtained through \ $ _ REQUEST as". $ _ REQUEST ["hkey"]. ". \ r \ n ";
Echo "the do value of the parameter is obtained as". $ _ GET ["do"]. ",";
Echo "the do value of the parameter is obtained as". $ _ POST ["do"]. ",";
Echo "the do value of the parameter is obtained through \ $ _ REQUEST as". $ _ REQUEST ["do"]. ". \ r \ n ";
?>
Processing result output:
The value of the parameter name is obtained through $ _ GET. The value of the parameter name is obtained as zkj through $ _ POST, and the value of the parameter name is obtained as zkj through $ _ REQUEST.
The value of parm is obtained as url-post through $ _ GET, the value of parm is obtained through $ _ POST, and the value of parm is obtained as url-post through $ _ REQUEST.
The value of the hkey is obtained through $ _ GET, and the value of the hkey is obtained as hvalue through $ _ POST. The value of the hkey is obtained as hvalue through $ _ REQUEST.
The do value of the parameter is obtained as index through $ _ GET, the do value of the parameter is obtained through $ _ POST, and the do value of the parameter is obtained as index through $ _ REQUEST.
Conclusion:
The GET form value can be obtained through _ GET, but the parameter set through the url parameter of action cannot always be obtained.
The POST form value can be obtained through _ POST, but the parameter set through the action url parameter can be obtained through _ GET
The same variable can be obtained through _ GET, but the variable setting is hidden in the GET form. in the POST form, the variable is set through the url parameter of action.
Why? Because there are two types of form processing: GET and POST, how to pass the do parameter in both forms, in addition, it is always confusing to obtain data in the same way in the background...