<div class="container"> <br><br> <div class="row"> <form action="viewcourseware.php" method="get"> <div class="input-field col s6 offset-s3"> <select name="subject" id="subject" class="browser-default"> <option value="">Choose Subject</option> <?php $subjects = getsubjects($_SESSION["user"]["sem"], $_SESSION["user"]["stream"]); foreach ($subjects as $value) { if ($value["subjectid"] == $_GET["subject"]) { echo '<option value="' . $value["subjectid"] . '" selected>' . $value["subjectname"] . '</option>'; } else { echo '<option value="' . $value["subjectid"] . '">' . $value["subjectname"] . '</option>'; } } ?> </select> </div> <div class="input-field col s2"> <button type="submit" class="btn">Go</button> </div> </form> </div> <div class="row"> <?php $books = getbooks($_GET["subject"]); foreach ($books as $value) { ?>
<?php include '../includes/config.php'; if ($_SERVER["REQUEST_METHOD"] == "POST") { $sem = $_POST["semester"]; $stream = $_POST["subjectid"]; $arr = getsubjects($stream, $sem); echo json_encode($arr); //echo json_encode((getsubjects($stream,$sem)); } else { redirect("/"); }