I am trying to populate a Drop down box from results of a mySQL Query, in Php. I\'ve looked up examples online and I\'ve tried them on my webpage, but for some reason they j
What if you want to use both id and name in the dropdown? Here is the code for that:
$mysqli = new mysqli($servername, $username, $password, $dbname); $sqlSelect = "SELECT BrandID, BrandName FROM BrandMaster"; $result = $mysqli -> query ($sqlSelect); echo ""; while ($row = mysqli_fetch_array($result)) { unset($id, $name); $id = $row['BrandID']; $name = $row['BrandName']; echo ''.$name.''; } echo "";