Advertisement
giakAdi

Untitled

May 21st, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.34 KB | None | 0 0
  1. echo '<select>';
  2.     foreach(categories as category){
  3.       if (category->id() === $parentCategory){
  4.         echo '<option value="' . category['id'] . '" selected ="selected">' . category->name() . '</option>';
  5.       }else{
  6.         echo '<option value="' . category['id'] . '">' . category->name() . '</option>';
  7.       }
  8.     }
  9. echo '</select>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement