我想根据下拉选择列表显示数据

I'm creating an PHP web application with SQL data and want to display the logs based on the drop down selection. I have created the drop down unique list for column data. then I will select the username and it should display the data related to that username will be tabulated. Please help me. Thanks in advance

Here is the source code:

<?php
$serverName = "TestDB,1433"; //serverName\instanceName
$connectionInfo = array(
    "Database" => "Database123",
    "UID" => "sa",
    "PWD" => "Pass.124"
);
$conn = sqlsrv_connect($serverName, $connectionInfo);

if ($conn)
{
    echo "Connection established.<br />";
}
else
{
    echo "Connection could not be established.<br />";
    die(print_r(sqlsrv_errors() , true));
}
$sql = "SELECT DISTINCT username from [Database123].[dbo].[LOG] ";
$stmt = sqlsrv_query($conn, $sql);
if ($stmt === false)
{
    die(print_r(sqlsrv_errors() , true));
}

echo "<table border='1'>
<table class='table'>

<thead>
<tr>
<th class='w'> User name</th>
<th> Log Time</th>
</tr>
</thead>";
echo "</select>";
while ($row = sqlsrv_fetch_Array($stmt, SQLSRV_FETCH_BOTH))
{
    echo "<option value=";
    echo $row['username'];
    echo ">";
    echo $row['username'];
    echo "</option>";
    echo "<select>";

    sqlsrv_close($conn);
?>

Use select box like this

echo "<select>";
while ($row = sqlsrv_fetch_Array($stmt, SQLSRV_FETCH_BOTH))
{
    echo "<option value=".$row['username'].">".$row['username']."</option>";
}
echo "</select>";
sqlsrv_close($conn);

</div>