Welcome Guest, Not a member yet? Register   Sign In
Pass multiple arrays/datasets into view...
#1

[eluser]dharmy[/eluser]
Hi there

I'v been working on this all afternoon but am not having much luck. Simply put, I have a view that is accepting data from 2 queries (into two different select fields).

The code for the controller - can anyone tell me where I am going wrong?

Code:
public function ShowForm()
{
  
  $this->load->model('htc_model');
  $this->load->library('parser');
  $listmobiles['country'] = $this->htc_model->GetCountryList();
  $listmobiles['mobile'] = $this->htc_model->GetMobiles();

  $home_top = $this->load->view('showform', $listmobiles, true);
  
  $data = array(
              'pagetitle'   => 'Page title goes here',
       'sitename'   => 'sitename goes here',
              'metakeywords' => 'metakeywords go here',
     'metadesc' => 'metadescription go here',
     'home_top' => $home_top,
     'top_left' => '$top_left',
     'home_middle' => '$home_middle',
     'home_bottom' => '$home_bottom',
     'footer' => '$footer'
            );

  $this->parser->parse('home_template', $data);  
}

I don't know how the view should be fetching the data. At the moment I have a country list working OK, but not the 2nd array / dataset:

Code:
<form>
<table width="60%">
<tr>
  <td><label for="country">Select Your Country</label></td>
  <td>
   <select name="country" class="country">
   <option>-- Select --</option>
   &lt;?php    
      foreach($data['country'] as $Result) {
       echo "<option value=" . $Result-&gt;country_id . ">" . $Result->country_name . "</option>\n";
      }
      //var_dump($data);
     ?&gt;  
   </select><br>  
  </td>
</tr>

<tr>
  <td>HTC Model</td>
  <td>
   <select name="model" class="model">
   &lt;?php
    
      foreach($data['mobile'] as $Result) {
       echo "<option value=" . $Result-&gt;model_ub_id . ">" . $Result->model_name . "</option>\n";
      }
      //var_dump($data);
     ?&gt;  
   </select><br>  
  </td>
</tr>


Messages In This Thread
Pass multiple arrays/datasets into view... - by El Forum - 02-11-2012, 12:39 PM
Pass multiple arrays/datasets into view... - by El Forum - 02-11-2012, 01:08 PM
Pass multiple arrays/datasets into view... - by El Forum - 02-11-2012, 01:43 PM
Pass multiple arrays/datasets into view... - by El Forum - 02-11-2012, 01:53 PM
Pass multiple arrays/datasets into view... - by El Forum - 02-11-2012, 02:06 PM
Pass multiple arrays/datasets into view... - by El Forum - 02-11-2012, 02:16 PM
Pass multiple arrays/datasets into view... - by El Forum - 02-11-2012, 02:21 PM
Pass multiple arrays/datasets into view... - by El Forum - 02-11-2012, 02:23 PM
Pass multiple arrays/datasets into view... - by El Forum - 02-11-2012, 04:32 PM
Pass multiple arrays/datasets into view... - by El Forum - 02-12-2012, 02:55 AM
Pass multiple arrays/datasets into view... - by El Forum - 02-12-2012, 05:04 AM
Pass multiple arrays/datasets into view... - by El Forum - 02-12-2012, 07:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB