lundi 8 août 2016

Compare two arrays if a match found do something

I have two arrays one is categories and another is categories_two the category array contains the whole categories from the table and the categories_two contains the categories selected(selected on adding of the item now want to use for updating)

<div class="col-sm-10">
  <?php 
     foreach ($categories as $c) {
  ?>

    <div class="i-checks"><label> <input type="checkbox" value="<?=$c->category_id?>" name="categories[]"> <i></i> <?=$c->category_name?> </label></div>
  <?php

    }
  ?>

</div>

and i have the selected categories so now i want to tick the selected categories. how to do that?




Aucun commentaire:

Enregistrer un commentaire