lcollong
FabriKant d'applications web
Hi,
Using a form as search input, I set a radiobutton element to choose the year based on a sql query :
It works perfectly. But is there any mean to set the default value (the first choice in my case) ?
Using a form as search input, I set a radiobutton element to choose the year based on a sql query :
PHP:
$db = JFactory::getDbo();
$db->setQuery('SELECT DISTINCT YEAR(date_mes) as y FROM MESURE WHERE date_mes > DATE("2000-01-01") ORDER BY y DESC');
$rows = $db->loadObjectList();
foreach ($rows as $row) {
$options[] = JHTML::_('select.option', $row->y, $row->y);
}
return $options;
It works perfectly. But is there any mean to set the default value (the first choice in my case) ?