title: Codeigniter - passing multiple data arrays to a view?
body: <p>I am trying to populate a dropdown menu on an events page with a list of locations.</p>
  
  <p>What I wish to do is retrieve all names from a locations table, store them in an array in my event.php controller, pass this to a view which then lists all the locations in a dropdown menu.</p>
  
  <p>Here is the loop in my controller which retrieves the locations..</p>
  
  <pre><code>$result = $this-&gt;locationModel-&gt;get_locations_list();
  $arr[] = '';
  foreach ($result as $val)
      $arr[$val-&gt;id] = $val-&gt;name;
  </code></pre>
  
  <p>I am already passing a variable to my view called $data like so -  <code>$this-&gt;template-&gt;load('admin/template', 'admin/eventEdit', $data);</code></p>
  
  <p>I have tried passing the $arr variable and the $data array in the above line but this stops the view from rendering.</p>
  
  <p>Please could someone guide me on how to pass the information that is stored in the $arr variable to my view along with the $data variable.</p>
  
  <p>Thanks</p>
  
  <p>Dan</p>
  
  <p>Thanks
  Dan</p>
  
  <p>New Code</p>
  
  <p>Controller</p>
  
  <pre><code>foreach ($result as $val){ $arr[$val-&gt;id] = $val-&gt;id; } 
  $data['navarr'] = $arr; 
  </code></pre>
  
  <p>View 
  <code>&lt;?php foreach($navarr as $value) { $html .= '&lt;option value="'.$value['id'].'"&gt;'.$value['name'].'&lt;/option&gt;'; } echo $html; ?&gt;</code></p>