Get the selected option from drop down list

I have been searching and trying many suggestions I found, but until now nothing seems to be doing the trick. If possible I want to get this done in php (value needs to be in $ to build db-query).

Your course selection drop-down must be enclosed within a <form> tag with a submit button, like this

    <?php 
       $course = "';
       if(isset($_POST['course'])) $course = $_POST['course'];

          <div class="search-bar-container">

             <form method="POST">

               <div class="drop-down-course">
                  <select class="course" name="course">
                     <option disabled selected value="0"> - gang - </option>
                     <?php
                       // Get all the options from the database for the 'course' drop down list.
                       $my_course = $wpdb -> get_results( "SELECT term_id, name FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy = 'wprm_course') " )  ; 
                       if (!empty ($my_course ) ) {
                           foreach ( $my_course as $my_course ) {
                               echo '<option value ="' . $my_course -> term_id . '" ' . selected($my_course -> term_id , $course).'>' . $my_course -> name . '</option>';
                            }
                       }
                ?>
                   </select>
             </div>

             <input type="submit" value="Go">
          </form>

       </div>


    <?php

          // Get posts using $course as your selected option here
    ?>