Buy Now
Sign in

Dynamic value in dropdpwn from a sql query

M.Abletech , June 01 at 14:47
M
M.Abletech
Hi,
I need to dynamically populate a dropdown from an sql query.
I think what I need is this:
<?php​
​$db = \JFactory::getDBO();​
​$query = "​
​SELECT `id` , `archivio` ​
​FROM `kizgv_arxivar_IXCE_giugno2018` ​
​WHERE `id` >3​
​";​
​$db->setQuery($query);​
​$form->data['ixce2'] = $db->loadResult();​
​?>
Just I don't know where tu put it... and where to set which is the value and which the label.
Any suggest?
GreyHead
Hi M.Abletech,
You can read the data with a DB Read action, or include your PHP in a Custom Code action. Then use the Dynamic Data tab of the Select DropDown element to add the results to the element settings.
Please see this FAQ for more info
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much