Question: found this from [one of the answers from this question](https://stackoverflow.com/questions/33117718/get-the-value-from-database-in-selecte-tag-html-php-mysql)

And I would like to ask, is there something wrong with this?
I've var\_dump the column course right it displays BSIT.
But I couldn't get if the user is BSIT it goes to the BSCS selected option.

```
<select class="form-control" name="course">
    <?php
        if ($row['course'] == 'BSIT') {

        echo "<option selected>BSIT</option>";
        echo "<option>BSCS</option>";

        } else {
        echo "<option selected>BSCS</option>";
        echo "<option>BSIT</option>";
    }
    ?>
</select>    

```

Answer: 
Actually you should declare variable for $row=['course']

```
 <select class="form-control" name="course">
    <?php
        if ($course == 'Bachelor of Science in Information Technology') {

        echo "<option value='Bachelor of Science in Information Technology' selected>Bachelor of Science in Information Technology</option>";
        echo "<option value='Bachelor of Science in Computer Science'>Bachelor of Science in Computer Science</option>";

    } else {
        echo "<option value='Bachelor of Science in Computer Science' selected>Bachelor of Science in Computer Science</option>";
        echo "<option value='Bachelor of Science in Information Technology'>Bachelor of Science in Information Technology</option>";
    }
    ?>
</select>

```

I've tested it. It's Working
I think this will more help to you. Please try this one

```
<select class="form-control" name="course" value="<?php echo $row['course']; ?>">
   <option value="BSIT">BSIT</option>
   <option value="BSCS">BSCS</option>
</select>

```

That coure value will be show in dropdown box..