I'm working on a dropdown menu that has items from the database using PHP for each loop The code is making only one dropdown item but the database have more than 1 rows so where is the problem?
Table:
-------------------------------------
| id | Address | text |
-------------------------------------
| 1 | foo | 5 |
-------------------------------------
| 2 | bar | 13 |
-------------------------------------
the dropdown contains [ foo ] only.
<?php foreach($items as $newitem){?>
<div class="dropdown-menu" style="height:29vh; width:30vh;"aria-labelledby="myInput">
<a class="dropdown-item" href="#"><?=$newitem['name'];?></a>
</div>
<?}?>
source https://stackoverflow.com/questions/68595482/dropdown-menu-items-with-php-foreach
Comments
Post a Comment