title: Codeigniter form_helper getting database rows to be values in select menu
body: <p>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:</p>
  
  <p>My view</p>
  
  <pre><code>&lt;?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();
  ?&gt;
  </code></pre>
  
  <p>My controller</p>
  
  <pre><code>function add_content() {
      $data = array();
      $this-&gt;is_logged_in();
      $this-&gt;load-&gt;model('category_model');
      $data['select_options'] = $this-&gt;category_model-&gt;get_all_online();
      $this-&gt;load-&gt;view('admin/content/add_content', $data);
  }
  </code></pre>
  
  <p>my model</p>
  
  <pre><code>public function get_all_online() {
      $this-&gt;db-&gt;select('*');
      $this-&gt;db-&gt;from('category');
      $this-&gt;db-&gt;where('category_online', 1);
      $query = $this-&gt;db-&gt;get();
  
      return $query-&gt;result();
  
  }
  </code></pre>
  
  <p>now when I place the <code>$selected_options</code> in the form dropdown I get this error,</p>
  
  <blockquote>
    <p>A PHP Error was encountered</p>
    
    <p>Severity: 4096</p>
    
    <p>Message: Object of class stdClass
    could not be converted to string</p>
    
    <p>Filename: helpers/form_helper.php</p>
    
    <p>Line Number: 331</p>
  </blockquote>