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’ => ”));

Written by Bala Krishna

Bala Krishna is web developer and occasional blogger from Bhopal, MP, India. He like to share idea, issue he face while working with the code.

This article has 1 comments

  1. MDunkleSr

    Do you know of a way to get the full post variable using JInput? And how to write that back after adding results?