Hi there,
I've been trying to fill a dropdown, unfortunately without success. First I've tried to fill it with data from a Read Data action, but I need to join tables which isn't possible. So I moved on to writing a query in php.
$db = JFactory::getDbo();
$query = $db->getQuery(true);
QUERY
$db->setQuery((string)$query);
return $db->loadAssocList();
In the debugger I get this:
Now what happens is that my dropdown is filled with: Array, Array.
I want it like this: (value subscription_id) course_name - subscription_name. So I want course_name - subscription_name to be viewed in the dropdown and I want the subscription_id as value to use somewhere else.
What am I doing wrong and how can I get the result I want?
I hope my question and examples are clear enough.
Kind regards,
Nando
I've been trying to fill a dropdown, unfortunately without success. First I've tried to fill it with data from a Read Data action, but I need to join tables which isn't possible. So I moved on to writing a query in php.
$db = JFactory::getDbo();
$query = $db->getQuery(true);
QUERY
$db->setQuery((string)$query);
return $db->loadAssocList();
In the debugger I get this:
[php12] => Array
(
[returned] => Array
(
[0] => Array
(
[subscription_id] => 400000008
[subscription_name] => Jaarabonnement - Om de week 60 minuten (Volwassenen)
[course_name] => Zangles
)
[1] => Array
(
[subscription_id] => 400000001
[subscription_name] => Jaarabonnement - Wekelijks 30 minuten
[course_name] => Elektrisch Gitaarles
)
)
[var] => Array
(
[0] => Array
(
[subscription_id] => 400000008
[subscription_name] => Jaarabonnement - Om de week 60 minuten (Volwassenen)
[course_name] => Zangles
)
[1] => Array
(
[subscription_id] => 400000001
[subscription_name] => Jaarabonnement - Wekelijks 30 minuten
[course_name] => Elektrisch Gitaarles
)
)
)Inside my dropdown/select field I get the data with: {var:php12}
Now what happens is that my dropdown is filled with: Array, Array.
I want it like this: (value subscription_id) course_name - subscription_name. So I want course_name - subscription_name to be viewed in the dropdown and I want the subscription_id as value to use somewhere else.
What am I doing wrong and how can I get the result I want?
I hope my question and examples are clear enough.
Kind regards,
Nando
