[eluser]got 2 doodle[/eluser]
controller
Code:
$this->load->model('program_data');
$data ['themes'] = $this->program_data->get_theme_dropdown_array();
model
Code:
/*-----------------------------------------------------------------------*/
function get_theme_dropdown_array() {
/*-----------------------------------------------------------------------*/
/* get program by theme and count results */
$themes_array = array();
$themes_array[0] = 'Any';
$query = $this->db->select('id, name');
$query = $this->db->order_by("name");
$query = $this->db->get('theme');
if ($query->num_rows() > 0){
foreach ($query->result() as $row)
{ $themes_array[$row->id] = $row->name.' ('.$this->get_program_count_by_theme($row->id).')';}
}
return $themes_array;
}
in view
Code:
<?php
echo form_label('Theme', 'ptheme');
echo form_dropdown('theme', $themes, 'Any');
echo form_submit('by_theme', 'GO');
?>
hope this helps
doodle