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-

          if ( isset( $_POST['send']))
              print_r( $_POST );

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

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

Code to display modules-

      $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);
      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.

still stuck would really apreciate any help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.