Answer the question
In order to leave comments, you need to log in
How to iterate Select(option)?
The question is in the title.
I do it this way:
<select name="category" id="category" class="form-control form-control-xl">
<? $categories = R::findAll('category');
foreach ($categories as $category){ ?>
<option value="<?=$category->title_cat?>"><?=$category->title_cat?></option>
<? } ?>
</select>
Answer the question
In order to leave comments, you need to log in
Obviously, no one here can tell anything because no one knows if the R::findAll('category') function works correctly. The problem is definitely in it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question