nested foreach in codeigniter view nested foreach in codeigniter view codeigniter codeigniter

nested foreach in codeigniter view


Inside $data['process'] you need to have category ID and Inside $data['category'] also

then only you can match both ,For example the foreach loop will be like following

<?php        foreach ($category as $c) {            echo "<li>" . $c->CategoryName . "</li>";            foreach ($process as $r) {                if($r['cat_id']==$c['id']){echo "<li><a href=\"" . base_url() . "index.php/process/id/" . $r->ProcessID . "\" target=\"_blank\">" . $r->ProcessName . "</a></li>";       }            }        }    ?>

if Both Id matches then you will print them !

Happy coding !