开发者

problem with passing multiple arrays from controller to view in CI

开发者 https://www.devze.com 2023-04-03 03:15 出处:网络
I am using code igniter and I am trying to send multiple arrays to view this is multiple array in controller I pass this array to view

I am using code igniter and I am trying to send multiple arrays to view

this is multiple array in controller I pass this array to view

$data=Array ( 
  [email] => Array ( 
    [abv] => Array ( 
      [name] => Abv 
      [version] => 1.0.7 
      [description] => Get the contacts from a Abv account
      [base_version] => 1.8.4 
      [type] => email 
      [check_url] => http://m.abv.bg 
      [requirement] => email 
      [allowed_domains] => Array ( 
         [0] => /(abv.bg)/i
         [1] => /(gyuvetch.bg)/i
         [2] => /(gbg.bg)/i
      )
      [imported_details] => Array ( 
        [0] => first_name
        [1] => email_1
      ) 
    ) 
  )
)
$this->load->view('view', $data)

This is view,

<?php

  foreach($data as $type=>$providers) {
    if ($type == 'email')
      "<optgroup label='email group'>"
    else
      "<optgroup label='social group'>";
    foreach ($providers as $provider=>$details)
      "<option value='{$provider}'".($_POST['provider_box']==$provider?' selected':'').">{$details['name']}</option>";
   开发者_高级运维 "</optgroup>";
  }

?> 

It dose print out anything. can you explain why it dosent work?


You're missing the echos, that might explain why nothing prints out. For example:

echo "<optgroup label='email group'>";
0

精彩评论

暂无评论...
验证码 换一张
取 消