Váš formát by měl být tento:
$options = array(
'small' => 'Small Shirt',
'med' => 'Medium Shirt',
'large' => 'Large Shirt',
'xlarge' => 'Extra Large Shirt',
);
$shirts_on_sale = array('small', 'large');
echo form_dropdown('shirts', $options, 'large');
výsledkem by bylo:
<select name="shirts">
<option value="small">Small Shirt</option>
<option value="med">Medium Shirt</option>
<option value="large" selected="selected">Large Shirt</option>
<option value="xlarge">Extra Large Shirt</option>
</select>
ODKAZ ZDE
AKTUALIZACE
můžete to také zkusit, pokud chcete
MODEL
$this->db->select('airport_code, airport_name');
$this->db->order_by('airport_code', "asc");
$query = $this->db->get('airports');
if($query)
{
$query = $query->result_array();
return $query;
}
OVLÁDAČ
$query = $this->your_model->your_method();
if($query)
{
$data['myDropdown'] = $query;
$this->load->view('your_view', $data);
}
ZOBRAZIT – VÁŠ PROBLÉM S ROZVOZENÍM
<select>
<?php
foreach($myDropdown as $dd)
echo "<option value='". $dd['your_field'] ."'>". $dd['your_field'] ."</option>";
?>
</select>