Difference In Retrieving The Form Or Url Values.


What is the difference in calling the below statements? Which is more preferable to get the form values after submission?



  1. Yii::app()->request->getPost()


  1. $_REQUEST[]


[list=1][]CHttpRequest::getPost()[color="#1C2837"][size="2"]: only $_POST data[/size][/color][][color="#1C2837"][size="2"]Yii::app()->request->getPost(): same as 1 just a different way to write[/size][/color][]CHttpRequest::getParam()[size="2"] - not getParam[/size]s[size="2"]: first searches in $_GET then in $_POST, else defaultValue => NULL by default[/size][][size="2"]$_REQUEST: standard php way to receive $_GET, $_POST and $_COOKIE, nothing to do with yii.[/size][*][size="2"]CHttpRequest::getQuery(): only $_GET data[/size][/list]

Use 1 if you are only interested in $_POST data.

Use 5 if you are only interested in $_GET data.

Use 3 if you are interested in both.