title: Codeigniter - passing multiple values to view
body: <p>Okay, so generally I wouldn't have a problem doing this and it would be fairly straight forward, but not so much this time.</p>
  
  <p>Here is the relevant code in my controller:</p>
  
  <pre><code>// In order to properly build the form url, we need to include the
                  // category and product to the view
                  $this-&gt;data = array(
                          'category' =&gt; $category,
                          'product' =&gt; $product
                          );
  
                  // Load the product model and get editable values from the database
                  $this-&gt;load-&gt;model('productadmin/products_model');
                  $productInformation = $this-&gt;products_model-&gt;get_product_data($product);
  
                  // Modular code! Use variable-variables to prevent having to write multiple lines of code
                  // when we start returning more information from the data
                  foreach ( $productInformation as $variable =&gt; $value )
                  {
                      $this-&gt;data[$variable] = $value;
                  }
  </code></pre>
  
  <p>Now, ideally, I should be able to access $product, $category and any variables returned from the products model. Doing a print_r, I get the following:</p>
  
  <pre><code>Array ( [category] =&gt; 1 [product] =&gt; 1 [0] =&gt; Array ( [id] =&gt; 1 [product_name] =&gt; Duff ) )
  </code></pre>
  
  <p>Notice how what was generated by the foreach statement is contained in it's own array. The easiest solution, would be to know how to access that second array from the view, just by passing <code>$this-&gt;data</code>. </p>
  
  <p>If that's not do-able, what can I change that would assign the model's associative values inside the data array without creating another array inside of it? </p>
  
  <p>The model simply returns key, value pairs from a get_where statement.</p>