[Solved] Fetching records from MySQL database with PHP to populate a drop down list


You are messing up your single and double quotes. Try this:

<?php
include("db_config.php");
$sql="SELECT * FROM brojevi";
$result=mysqli_query($connection,$sql);
echo '<select name="dropdown" size="1">';
echo '<option value="choose">-choose-</option>';
while($row=mysqli_fetch_array($result)){
    $id = $row['id'];
    $broj = $row['brojevi'];
    echo '<option value="' . $id . '">' . $broj . '</option>';
}
echo '</select>';
?>

When using html tags inside your echo, try to use single quotes for the echo and double quotes for html stuff like values,id’s,classes etc.

solved Fetching records from MySQL database with PHP to populate a drop down list