Reputation: 577
Here is my code:
<?php
$hostname = "localhost";
$username = "root";
$password = "";
$databasename = "change_management";
$connect = mysqli_connect($hostname, $username, $password, $databasename);
$query3 = "SELECT `change_id` FROM `change_request_tbl` WHERE `review_by` IS NULL";
$result = mysqli_query($connect,$query3);
?>
<select name="change_id">
<?php
while ($row = mysqli_fetch_array($result))
{
echo "<option value='".$row['change_id']."'</option>";
}
?>
</select>
As you can see, I am trying to populate the drop down menu with change_id
values where the field review_by
IS NULL. At the moment, the drop down menu has blank values.
What am I doing wrong?
Upvotes: 0
Views: 75
Reputation: 1556
You have missed visible value in <option>Your value here</option>
Try changing
echo "<option value='".$row['change_id']."'</option>";
To
echo "<option value='".$row['change_id']."'>".$row['change_id']."</option>";
Upvotes: 2