I have a table with id and points.
id points
1 10
2 20
3 30
i am using below code to generate radio list in Eval populate. here issue is radio list loading without selected any value. i need to select id (2) as default value every time form loads. how to do it.
$db = JFactory::getDbo();
$db->setQuery('SELECT id, points FROM table ORDER BY id ASC');
$rows = $db->loadObjectList();
foreach ($rows as $row) {
$options[] = JHTML::_('select.option', $row->id, $row->points);
}
return $options;
id points
1 10
2 20
3 30
i am using below code to generate radio list in Eval populate. here issue is radio list loading without selected any value. i need to select id (2) as default value every time form loads. how to do it.
$db = JFactory::getDbo();
$db->setQuery('SELECT id, points FROM table ORDER BY id ASC');
$rows = $db->loadObjectList();
foreach ($rows as $row) {
$options[] = JHTML::_('select.option', $row->id, $row->points);
}
return $options;