title: CodeIgniter: Creating a dropdown field from an array, populated from database table data column
body: <p><strong>Model:</strong></p>
  
  <pre><code>function pop_room_type() {
      $this-&gt;db-&gt;select('rt_name')-&gt;from('room_type');
      $query=$this-&gt;db-&gt;get();
      return $query-&gt;result_array();
  }
  </code></pre>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>function index() {
      $this-&gt;load-&gt;model('reservations_model');
      $data['room_type'] = $this-&gt;reservations_model-&gt;pop_room_type();
      //echo "&lt;pre&gt;";print_r($data['room_type']);echo"&lt;/pre&gt;";
      $this-&gt;load-&gt;view('/main/new_reservation', $data);
  }
  </code></pre>
  
  <p><strong>View:</strong></p>
  
  <pre><code>&lt;?php 
  //$js = 'name='$room_type'';
  echo form_dropdown('room_type', $room_type);
  ?&gt;   
  </code></pre>
  
  <p><strong>However, there's a one BIG issue whereas the "name" of all select options are the same. All options in this dropdown carries the same value as in the column name of the (room_type) table: rt_name. I tried several things but still couldn't assign unique values to the name field of the options in the dropdown.</strong></p>