hi all,
I should set a default value for a dynamic select list:
the default value should be '1'. only how am I supposed to achieve that?
could somebody pls help me out?
I should set a default value for a dynamic select list:
<?php $db=& JFactory::getDBO(); ?>
<select size="1" label_over="0" hide_label="0" class="validate['required']" title="" type="select" name="ttype">
<option value=""><?php echo JText::_('PLEASE_SELECT'); ?></option>
<?php $db->setQuery("SELECT * FROM #__cf_ttypes ORDER BY `name` ");
$ttypes = $db->loadObjectList();
foreach ( $ttypes AS $ttype) {
$name = $ttype->name;
echo "<option value='" . $ttype->cf_id. "'>" . $name . "</option>";
} ?>
</select>
the default value should be '1'. only how am I supposed to achieve that?
could somebody pls help me out?
This topic is locked and no more replies can be posted.