[eluser]boony[/eluser]
Hi,
I'm not sure if I understand your problem, but if you want to populate a drop down box with values from your database this should work.
You should have a model, and in that model a function like this:
Code:
function drop_down_data()
{
$data = array();
$this->db->select('your_field'); //Put your field name here
$this->db->from('your_table'); //Put your table here
$query = $this->db->get();
foreach($query->result_array() as $row)
{
$data[$row['your_field']] = $row['your_field'];
}
return $data;
}
Now in your controller you should have something like this:
Code:
function get_drop_down_data()
{
$data['somestuff'] = $this->your_model->drop_down_data();
$this->load->view('your_view', $data);
}
And in your view, make the form *NOTE* that I'm using the form helper here (have a look in the user guide) and you will need to do all the other stuff. But this will now give you a select with your values.
Code:
echo '<p>'. form_label('Some Name','your_field');
echo form_dropdown('your_field', $somestuff) .'</p>';