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.
Heres the dropdown box code:
[code]
<?php $stmt = $db->prepare('Select Course_Name from coursename'); $stmt->execute(); while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo ''.$row['Course_Name'].''; } ?>[/code]
And heres another section of code that just prints out course module/code that I thought might make it easier to understand my question.
[code]<?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 “
” . $output->Module_Name . " " . $output->Module_Code . “
\n”;}
?> [/code]
Can anyone advise me as im lost.