<?php

            include('../../../config/config.php');

        
            $CampusID = trim($_POST['CampusID']);
            $studentID = trim($_POST['studentID']);
            $classID = trim($_POST['classID']);



            $select_subject  = mysqli_query($link, "SELECT DISTINCT `subjectorcourse`.`SubjectOrCourseID`,`subjectorcourse`.`SubjectOrCourseTitle` FROM `courseorsubjectallocation` INNER JOIN `subjectorcourse` ON  `courseorsubjectallocation`.`SubjectOrCourseID` = `subjectorcourse`.`SubjectOrCourseID` WHERE `courseorsubjectallocation`.`ClassOrDepartmentID`='$classID' AND `courseorsubjectallocation`.`CampusID`='$CampusID' ORDER BY `subjectorcourse`.`SubjectOrCourseTitle` ASC");

            $select_subject_cnt  = mysqli_num_rows($select_subject);
            $select_subject_cnt_rows = mysqli_fetch_assoc($select_subject);  


            if( $select_subject_cnt > 0)
            {

                    echo '<option value="NULL"> Select Subject</option>';


                    do{

                            $SubjectOrCourseID =  $select_subject_cnt_rows['SubjectOrCourseID'];
                            $SubjectOrCourseTitle =  $select_subject_cnt_rows['SubjectOrCourseTitle'];

                            echo '<option value="'.$SubjectOrCourseID.'">'.$SubjectOrCourseTitle.'</option>';



                    }while($select_subject_cnt_rows = mysqli_fetch_assoc($select_subject));

                    
            }else{

                echo '<option value="NULL">no record found</option>';

            }











 ?>