如何从数据库中填充HTML SELECT

I'm trying to get an HTML SELECT field within a form to be populated from a database column. I can read the column fine, and can use fprint or echo to see the results. The problem is, I can't seem to get the array based on the column to appear as selections in the SELECT field. I'm able to produce a field with a pull-down selector, but the values aren't populated. How to I get the values from the Array into an HTML SELECT / OPTION field? Here's a subset of the code I'm using:

<?php 
$link = new mysqli("localhost","USER","PASSWORD", "DATABASE");
  if (mysqli_connect_errno())
   {
   printf("Connect failed: %s
", mysqli_connect_error());
  exit();
}
if (!$link->set_charset("utf8")) 
{
    printf("Error loading character set utf8: %s
", $link->error);
    exit();
}

$role_sql = "SELECT role FROM lu_role";
$role_result = mysqli_query($link, $role_sql);
$options = "";
while($row1 = mysqli_fetch_array($role_result))
{
        $options = $options."<option>$row1[1]</option>";
}

//Using the following to validate that I can get the query results in an array.
while ($row = $role_result->fetch_assoc())
{
    printf($row["role"]);
}
?>
<form action="post.php" method="post">
    <table class="table_600_reg">
      <tr>
        <td width="120">Father</td>
        <td width="200" align="left">
            <select>
                <?php echo $options;?>
            </select>               

You are missing value="" here $options = $options."<option value='VALUE_HERE'>$row1[1]</option>";

And since you are selecting only one column it should be $row1[0] instead of $row1[1]

You may check your index in displaying your field. On your query, you only specified a field to be returned:

SELECT role FROM lu_role

So the index should start with '0' not '1'.

$options = $options."<option>$row1[0]</option>";

You may also use 'mysqli_fetch_assoc' so you can use $row1['role'] instead of relying on the index.

Try this :

$options = "";
while($row1 = mysqli_fetch_array($role_result))
{
        $options .= "<option value='".$row1['role']."'>$row1['role']</option>";
}

and then can you able to use

<select>
      <option value="">Select one</option>
      <?php echo $options;?>
</select>

you need to put your while statement inside the select tag

here is the code

<select>
<?php
while($row1 = mysqli_fetch_array($role_result))
{
        $options = $options."<option>$row1[1]</option>";
        echo '$options';

}

?>
            </select>    

I would personally refer to the associative array values instead of the indexed values. If you later decided you wanted to pull more results from that table to manipulate other data, the index could change.

while ($row = $role_result->fetch_assoc()) {
    $options .= "<option value='{$row['role']}'>{$row['role']}</option>";
}