how to fetch data in select option in php code example

how to fetch data in select option in php

1

1 Example

0
 <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>
by on

Other Code Examples