<?php
if(isset($_POST['type']))
{
      require_once('../../assets/config/config.php');
      $obj=new Database();
    if($_POST['type']=='s_id')
    {
       echo "<table  class='table table-striped table-bordered'>";
                      echo "<thead><tr>";
                      echo "<th>S.No</th>";
                         echo "<th>Student ID</th>";
                          echo "<th>Student Name</th>";
                          echo "<th>Course</th>";
                          echo "<th>Batch No</th>
                          <th>Date</th><th>Status</th>
                          
                        </tr>
                      </thead>
                      <tbody id='tbody'>";
                      ?>
                      <?php
                                
                                $obj=new Database();
                                $obj->select('students_course','*',null,'student_id="'.$_POST['id'].'"',null,null);
                                $result=$obj->getResult(); 
                                $c=0;
                                                              
                                foreach($result as list("student_id"=>$id,"student_name"=>$name,"course_name"=>$c_name,"batch_no"=>$batch,"status"=>$status,"date"=>$date))
                                {                                 
                                  $c=$c+1;
                                  echo "<tr><td>$c</td><td>$id</td><td>$name</td><td>$c_name</td><td>$batch</td><td>$date</td><td>$status</td></tr>";
                                }                              
                                ?>
                      </tbody>
                    </table>
<?php

    }
    if($_POST['type']=='batch')
    {

        echo "<table  class='table table-striped table-bordered'>";
        echo "<thead><tr>";
           echo "<th>Student ID</th>";
            echo "<th>Student Name</th>";
            echo "<th>Course</th>";
            echo "<th>Shift Time</th>
            <th>Date</th><th>Status</th>
            
          </tr>
        </thead>
        <tbody id='tbody'>";
        ?>
        <?php
                  
                  $obj=new Database();
                  $obj->select('students_course','*',null,'batch_no="'.$_POST['id'].'"',null,null);
                  $result=$obj->getResult(); 
                  $c=0;
                                                
                  foreach($result as list("student_id"=>$id,"student_name"=>$name,"course_name"=>$c_name,"shift_time"=>$batch,"status"=>$status,"date"=>$date))
                  {                                 
                    $c=$c+1;
                    echo "<tr><td>$id</td><td>$name</td><td>$c_name</td><td>$batch</td><td>$date</td><td>$status</td></tr>";
                  }                              
                  ?>
        </tbody>
      </table>
      <?php
        
    }




}



?>