Im trying to populate a dropdown box on a registraton form in code igniter but i have had not luck below are snippets from my contorller, model, and view. Base is the drop down
Your format should be like this:
$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');
this would produce:
REFER HERE
you could also try this if you want
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;
}
CONTROLLER
$query = $this->your_model->your_method();
if($query)
{
$data['myDropdown'] = $query;
$this->load->view('your_view', $data);
}
VIEW - YOUR DROPDOWN PROBLEM