I'm quite new to Joomla! (and PHP in general) and trying to learn by developing a website on my local Joomla!-Installation. I'm using WAMP-Server with PHP 5.5.12, Apache 2.4.9 and Joomla! 3.6.4.
Now I like to retrieve data from both $_POST
and $_GET
. Both are equaly insecure so it is only logical to retrieve and treat them together.
According to this article https://docs.joomla.org/Secure_coding_guidelines#Secure_strings i should be able to do it like this:
$string = JFactory::getApplication()->input->method->getString( 'myText', '' );
It's not working, complaining that 'method'
is a non-object. ('Fatal error: Call to a member function getString() on a non-object')
All other data-source's from that same list (e.g. 'get'
, 'post'
, 'cookie'
, 'request'
, etc.) do not produce any error and seem to work flawless.
Unfortunately I need to retrieve data from either $_POST or $_GET (or both, but without $_COOKIE) wich is exactly what data-source='method'
is supposed to do.
Of course I can use 'post'
and 'get'
sequentially but that seems stupid to me if there is an option wich could do it directly (less overhead? and slimmer code).
Than I maybe have to address priority, but let's leave that aside for now.
At https://docs.joomla.org/Retrieving_request_data_using_JInput the only Super-Global-'s mentioned are 'get'
, 'post'
and 'server'
. Not a word about the other sources that obviously
exist (no error occurring) or wich of the named sources is used as default.
My search has gone in circles for a while now and i can't find more related informations (targeting Joomla! or JInput
, not PHP
).
If I'm missing something fundamental here, feel free to tell me.
With this said my questions are now:
Is there any setting (or update) i have to make to get the 'method'
-data-source working?
Is there another value (!='method'
) for data-source in JInput
that can be used to directly retrieve data from exactly either $_POST
or $_GET
or do I need to sequentially call 'post'
and 'get'
to accomplish this (maybe 'method'
was renamed due to a conflict in names)?
Thanks for your time reading (and maybe answering).