How can I retrieve resource_id from the url below?


I've tried using the following code snippet

$jinput = JFactory::getApplication()->input
$multiple_res = $jinput->getVar('resource_id',array(),'', 'ARRAY');
  • why are you passing 2 times resource id in your URL ? – Nehal Feb 2 '16 at 7:15

You have to change your URL to:


Otherwise it will only get last resource_id value (45).

And get array of both values

$resource = $jinput->get('resource_id', array(), 'ARRAY');

results in

Array ( [0] => 43 [1] => 45 )

You need to be using get, rather than getVar.

Also, resource_id appears to be an integer, not an array.

You can use the following:

$jinput   = JFactory::getApplication()->input;
$resource = $jinput->get('resource_id', '', 'INT');


$jinput   = JFactory::getApplication()->input;
$resource = $jinput->getInt('resource_id', '');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.