How To Retrieve GET/POST Variable In Joomla
Joomla uses getVar method of JRequest class to retrieve GET/POST variable value. In Joomla 1.7 and above version JRequest class has been deprecated and JInput class used instead.
See following syntex to use with Joomla 1.0, 1.5 and above.
Joomla 1.0
$cid = mosGetParam($_REQUEST, ‘cid’, array());
Joomla 1.5
$cid = JRequest::getVar(‘cid’, array());
Get Single Variable Value
$var_value = JRequest::getVar(‘var_name’);
Full Syntex
$var_value = JRequest::getVar(‘var_name’, ‘default value goes here’, ‘post’,’variable type’);
Joomla 1.7 and higher
$jinput = JFactory::getApplication()->input;
To retrieve single value you can use below syntax.
Example1: $var_value = $jinput->get(‘varname’, ‘default_value’, ‘filter’);
To retrieve multiple values in array you can use below syntex.
Example2: $varValuesArray = $jinput->getArray(array(‘var1’ => ”, ‘var2’ => ”, ‘var3’ => ”));
Do you know of a way to get the full post variable using JInput? And how to write that back after adding results?