I have to add a second dropdown box that is triggered using the same send button.
So heres the code for one dropdown box:
[code]<?php
require_once(‘connect.php’);
  if ( isset( $_POST['send']))
  
  {
  
      echo "<br>Course ID is: $_POST['Course_Name']<br><br>";
       $sql = "SELECT Module_Name,ModuleID, Module_Code, Module_Year  FROM coursemodule WHERE CourseID = :courseId ORDER BY ModuleID ASC";
     $stmt = $db->prepare($sql);
     $stmt->bindParam(':courseId', $_POST['Course_Name'], PDO::PARAM_INT);
     $stmt->execute();
     while ($output = $stmt->fetch(PDO::FETCH_OBJ)) {
        echo "<p>" . $output['Module_Name']  . " " . $output['Module_Code']  . "</p>\n";
   }
}
?>
   
      
      <?php
     $stmt = $db->prepare('Select Course_Name, CourseID from coursename');
     $stmt->execute();
        while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
      echo "<option value='{$row['CourseID']}'>{$row['Course_Name']}</option>";
        }
    ?>
 </select> 
   
   
[/code]
And heres my attempt at adding a second dropdown box.
[code]<?php
      require_once('connect.php');
  if ( isset( $_POST['send']))
  
  {
  
      echo "<br>Course ID is: $_POST['Course_Name']<br><br>";
       $sql = "SELECT Module_Name,ModuleID, Module_Code, Module_Year  FROM coursemodule WHERE CourseID = :courseId ORDER BY ModuleID ASC";
	   
     $stmt = $db->prepare($sql);
	 $sql1 = "SELECT Module_Name,ModuleID, Module_Code, Module_Year  FROM coursemodule WHERE CourseID = :courseId ORDER BY ModuleID ASC";
	 $stmt1 = $db->prepare($sql1);
     $stmt->bindParam(':courseId', $_POST['Course_Name'], PDO::PARAM_INT);
	 $stmt1->bindParam(':courseId', $_POST['Course_Name'], PDO::PARAM_INT);
	 
     $stmt->execute();
	 $stmt1->execute();
	 
     while ($output = $stmt->fetch(PDO::FETCH_OBJ)) {
        echo "<p>" . $output['Module_Name']  . " " . $output['Module_Code']  . "</p>\n";
		
		while ($output = $stmt1->fetch(PDO::FETCH_OBJ)) {
        echo "<p>" . $output['Module_Name']  . " " . $output['Module_Code']  . "</p>\n";
   }
}
?>
   
      
      <?php
     $stmt = $db->prepare('Select Course_Name, CourseID from coursename');
     $stmt->execute();
	
        while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
      echo "<option value='{$row['CourseID']}'>{$row['Course_Name']}</option>";
	  
	  $stmt1 = $db->prepare('Select Course_Name, CourseID from coursename');
     $stmt1->execute();
	  
	  while($row = $stmt1->fetch(PDO::FETCH_ASSOC)) {
      echo "<option value='{$row['CourseID']}'>{$row['Course_Name']}</option>";
        } 
     ?>
 </select> 
   
   [/code]
Is this the right idea or am I going about this the wrong way?