protected function sectionstudentvalidate() { $required = array("section" => "Section", "student_id" => "Student"); global $user; if ($user->checkAdmin() == true) { if (isset($_POST)) { foreach ($required as $key => $value) { if (!isset($_POST[$key]) || $_POST[$key] == '' || $_POST[$key] == 'select') { echo $value . ' is Required<br/>'; return; } } echo 'Saving...'; global $objPDO; require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/student_section_class.php'; $section = new Studentsection($objPDO); $section->setSectionId($_POST['section']); $section->setStudentId($_POST['student_id']); $section->save(); } } else { header('Location:http://localhost/cloud'); } }