title: Codeigniter, Dynamic Menus From the Database
body: <p>I am Trying to Implement the Dynamic Menus</p>
  
  <p>i Have two Tables in my Database
  <code>pbs_forms</code> includes Form Path Form Path link etc
  <img src="https://i.stack.imgur.com/SLkjo.jpg" alt="enter image description here"></p>
  
  <p>Second Table Name is <code>pbs_formsingroups</code>
  it shows that form belongs to which group
  <img src="https://i.stack.imgur.com/Prbnf.jpg" alt="enter image description here"></p>
  
  <p>Here is how right now i am getting data in my view</p>
  
  <pre><code>$GetForms=$this-&gt;CommonModel-&gt;get_by_join($columns,$PTable,$joins,$where);
  
  foreach($GetForms as $key =&gt; $row){
      list($NavBar, $MainMenu, $SubMenu) = explode("/", $row['FormPath']);
      $arrayLeftMenuList = array();
      $arrayLeftMenuList[$key]['NavBarMenuLink'] = $NavBar;
      $arrayLeftMenuList[$key]['LeftMainMenu'] = $MainMenu;
      $arrayLeftMenuList[$key]['LeftSubMenu'] = $SubMenu;
      $arrayLeftMenuList[$key]['FormCIPath'] = $row['FormCIPath'];
      $arrayLeftMenuList[$key]['MainMenu_OrderNo'] = $row['Order_MainMenu_No'];
      $arrayLeftMenuList[$key]['SubMenu_OrderNo'] = $row['Order_SubMenu_No'];
      $arrayLeftMenuList[$key]['HaveSubMenus'] = $row['SubMenu'];
  }
  </code></pre>
  
  <p>Data is Coming from the Database Fine..</p>
  
  <p>Now When i Try This in Code:</p>
  
  <pre><code>foreach($arrayLeftMenuList as $key =&gt; $value){
      echo $arrayLeftMenuList[$key]['LeftSubMenu'];
  }
  </code></pre>
  
  <p>In Result I only Get</p>
  
  <pre><code>Users
  </code></pre>
  
  <p>Instead I should Be Getting Both <code>Search Prize Bond</code> and <code>Users</code>?</p>
  
  <p>Can Anyone Understand the Problem i have Stated above and Show me a solution that how to solve this issue?</p>