I know this is going to be really simple once I post it,
I am writing a form, which has a select menu in it, I want the values to pulled from the database, so I thought it would be something along these lines,
My view
<?php
echo form_open('admin/save_content');
echo form_fieldset();
echo form_dropdown('categories', $select_options);
echo form_submit('category_submit', 'Submit');
echo form_fieldset_close();
echo form_close();
?>
My controller
function add_content() {
$data = array();
$this->is_logged_in();
$this->load->model('category_model');
$data['select_options'] = $this->category_model->get_all_online();
$this->load->view('admin/content/add_content', $data);
}
my model
public function get_all_online() {
$this->db->select('*');
$this->db->from('category');
$this->db->where('category_online', 1);
$query = $this->db->get();
return $query->result();
}
now when I place the $selected_options
in the form dropdown I get this error,
A PHP Error was encountered
Severity: 4096
Message: Object of class stdClass could not be converted to string
Filename: helpers/form_helper.php
Line Number: 331