$gradeLevelError = 'Please Select Grade Level?'; $valid = false; } } } } //Validate Forum Topic if (empty($forumTopic)) { $forumTopicError = 'Please Enter Topic of The Forum?'; $valid = false; } //Insert Data In To Forums Table if ($valid) { $sql = "INSERT INTO Forums (Forum_Title,Forum_Topic,Grade_Level,Starting_Date,Starting_Time,Added_By,Forum_Status) VALUES (?,?,?,?,?,?,?)"; $q = $pdo->prepare($sql); $q->execute(array($forumTitle, $forumTopic, $gradeLevel, date("Y-m-d"), date("h:i:sa"), $api->User_Name($_SESSION['user_session'], $pdo), "New")); header("Location: manageForums.php?page=new&forum=added"); } } else { if ($page == 'new' || $page == 'ignored' || $page == 'blocked' || $page == 'confirmed' || $page == 'suspended') { //Preparing sql to Fetch Discussions Based on thier Topic_Status $sql = "SELECT * FROM Forums where Forum_Status = ?"; $q = $pdo->prepare($sql); //Fetching All Froums With Forum_Status=New if ($page == 'new') { $q->execute(array('New')); $sql1 = 'SELECT * FROM Forums where Forum_Status = "New" LIMIT ' . $startrow . ', 5'; } else { if ($page == 'blocked') { $q->execute(array('Blocked')); $sql1 = 'SELECT * FROM Forums where Forum_Status = "Blocked" LIMIT ' . $startrow . ', 5';
//Validate Grade Level if ($gradeLevel !== 'Grade9') { if ($gradeLevel !== 'Grade10') { if ($gradeLevel !== 'Grade11') { if ($gradeLevel !== 'Grade12') { $gradeLevelError = 'Please Select Grade Level'; $valid = false; } } } } // Insert Data In To Labs Table if ($valid) { $sql = "INSERT INTO Labs (Lab_Title,Grade_Level,Description,Registration_Date,Registration_Time,Added_By,Lab_Status) VALUES (?,?,?,?,?,?,?)"; $q = $pdo->prepare($sql); $q->execute(array($title, $gradeLevel, $description, date("Y-m-d"), date("h:i:sa"), $api->User_Name($_SESSION['user_session'], $pdo), "New")); header("Location: instructors.php?page=new&lab=added"); } } //End of adding new lab if ($page == 'new') { $sql = 'SELECT * FROM Labs where Lab_Status = ? AND Added_By = ?'; $q = $pdo->prepare($sql); $q->execute(array('New', $api->User_Name($_SESSION['user_session'], $pdo))); $sql1 = 'SELECT * FROM Labs where Lab_Status = "New" AND Added_By = "' . $api->User_Name($_SESSION['user_session'], $pdo) . '" LIMIT ' . $startrow . ', 5'; $data = $q->fetch(PDO::FETCH_ASSOC); //converting the fetched data into associated array $count = $q->rowCount(); //counting the number of fetched rows } else { if ($page == 'confirmed' || $page == 'video') {