0

I am trying to get a dropdown box to choose what is printed out.
The dropdown is populated by course names and when a selection is made I want certain course modules releated to that course printed.

Code to post course name-

?php
          if ( isset( $_POST['send']))
          {
              print_r( $_POST );
          }
      ?>



  <form method='post'>
    <select id="Course_Name" name="Course_Name">
    <?php


       $stmt = $db->prepare('Select Course_Name, CourseID from coursename');
       $stmt->execute();
          while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
       echo '<option>'.$row['Course_Name'].'</option>';
          }
       ?>
   </select> 
 <input type="submit" value="Send" name="send">
 </form>

Code to display modules-

<?php
      require_once('connect.php');
      $sql = "SELECT CourseID, Module_Name,ModuleID, Module_Code, Module_Year  FROM coursemodule ORDER BY ModuleID ASC";
      $stmt = $db->prepare($sql);
      $stmt->bindParam(':ModuleID', $CourseID, PDO::PARAM_INT);
      $stmt->execute();
      while ($output = $stmt->fetch(PDO::FETCH_OBJ)) {
         echo "<p>" . $output->Module_Name  . " " . $output->Module_Code  . "</p>\n";

    }
 ?>

Currently the selection doesn't affect the module output and thats what I am trying to do.
Any help would be appreciated.

1
Contributor
1
Reply
26
Views
2 Years
Discussion Span
Last Post by mkra
0

still stuck would really apreciate any help.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.