I need to fetch data from database and put it in my dropdownlist as choices so far nothing is showing in the dropdownlist
MODEL
function getAllGroups()
{
$query = $this->db->query('SELECT firstname FROM tblsec');
return $query->result();
}
VIEW
foreach($groups as $row)
{
echo '<option value="'.$row->firstname.'">'.$row->firstname.'</option>';
}
?>
</select>
CONTROLLER
public function salesorders() {
if ($this->session->userdata('logged_in')) {
$this->header2();
$data['groups'] = $this->secretary_model->getAllGroups();
$this->load->view('secretary/transactions');
} else {
redirect('secretary/sec_login_view');
}
}