I am using Joomla 3.4. And I am using standard Joomla way to GET parameters. let's assume url contains signup?company=ZITO%20MEDIA,%20LP
According Joomla Standard code
$config = new JConfig();
$jinput = JFactory::getApplication()->input;
echo $jinput->get->get('company');
The result: ZITOMEDIALP
But if I change the code to standard php code
echo $_GET['company'];
The result: ZITO MEDIA, LP
I want to use joomla code since I working on joomla project but this is not what I want.
any ideas? and it happens to POST variables as well.
According to the documentation, JInput by default applies the "cmd" filter which basically strips off whatever is not a-z.
You should apply the desired filter, e.g. "int", "string", "word", ... with this syntax:
$jinput->get('varname', 'default_value', 'filtername');
There is also a shorthand method for most of the filters, for example the following two lines of code are equivalent:
$jinput->get('varname', 'default_value', 'string');
$jinput->getString('varname', 'default_value');
change
$jinput = JFactory::getApplication()->input;
echo $jinput->get->get('company');
to
$jinput = JFactory::getApplication()->input;
echo $jinput->getString('company', 'default_value');
use a default value as well in order to be able to handle the case of a missing parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With