SQL查询到选项表单

I have a PHP code to get info from my Microsoft SQL server 2014, but it isnt working, the page it self works fine since it pops up as it should when i comment out the PHP code, but as soon as the PHP code isnt commented out, its just all white, so im assuming problem with the PHP code. I have to get the results from the query out into a drop down menu.

i use this code:

$servername = "VCCSQL03";
$username = "forecast";
$password = "Telefon2";
$dbname = "Forecast";

$connectionInfo = array("Database"=>$dbname, "UID"=>$username, "PWD"=>$password);
$conn = sqlsrv_connect($serverName, $connectionInfo);

if(!$conn) {
    echo "Connection could not be established.<br />";
    die( print_r( sqlsrv_errors(), true));
}

// Check connection
$result = sqlsrv_query($conn,"SELECT * FROM dbo.vw_BrandProduct");
if ($result->num_rows > 0) {
    // output data of each row
    while($row = sqlsrv_fetch_array($result)) {
        echo "<option value='".$row['Brand_ProductID']."' name='".$row['Brand_ProductName']."'</option>";
    }
} else {
    echo "";
}
sqlsrv_close();

First and foremost, you do not have an open and closed select tag, and your option tags was missing a > to close it properly. Try the below revision, assuming connection is established on the page properly then this should work.

$connectionInfo = array( "Database"=>$dbname, "UID"=>$username, "PWD"=>$password);
$conn = sqlsrv_connect( $serverName, $connectionInfo);

         if(!$conn) {
          //// Check connection
             echo "Connection could not be established.<br />";
                   die( print_r( sqlsrv_errors(), true));
               }

     $result = sqlsrv_query($conn,"SELECT * FROM dbo.vw_BrandProduct"); 
    if ($result->num_rows > 0) {

   // output data of each row
    echo "<select name='products'>";
           while($row = sqlsrv_fetch_array($result)) {
         echo "<option value='".$row['Brand_ProductID']."'>$row['Brand_ProductName']</option>";
} 
echo "</select>";

    } else {
echo ""; } sqlsrv_close(); ?>