php:提交后保留从数据库中选择的下拉值

There is a dropdownlist in my page which is filled by database values, when the user choose a value from database and click on the submit button , the selected value doesnt retain after refreshing the page

I used these codes to keep the selected value but it doesnt work ,I dont know where is the problem

 <?php
    $query = "SELECT * FROM Sellers ORDER BY Sellers ";
    $result = mysqli_query($db,$query);

    echo "<select name='seller' id='seller'>";
    while ($row = $result->fetch_assoc()) {

        echo "<option ";
        if ($_POST['seller'] == $row['seller_name']) echo 'selected';
        echo "value='" . $row['seller_name'] ."'>" . $row['seller_name'] ."</option>";
    }
    echo "</select>";


    ?>

I found the problem :

I changed if ($_POST['seller'] == $row['seller_name']) echo 'selected'; to if ($_POST['seller'] == $row['seller_name']) echo 'selected="selected"'; and it works properly