
<?php
include_once "config.php";




if ($_POST['classname']!="") {

    $class_name = $_POST['classname'];

//$class_name = 'ELEVEN';
//$class_name = json_encode($class_name);

//echo $class_name;
$val="";
foreach ($class_name as $value) {
    $val .= "'".$value."',";
  }
  $class_name =substr_replace($val ,"",-1);
  //echo $class_name;

    //$class_name = mysqli_real_escape_string($link,$_POST['classname']);
    //echo $class_name;
    $st_group=mysqli_real_escape_string($link,$_POST['studentgroup']);
    $stupp=strtoupper($st_group);
    if ($stupp=='S'){
        $st_grp= " AND st_group='SCIENCE'";
    }else if($stupp=='H'){
        $st_grp=" AND st_group='HUMANITIES'";
    }else if($stupp=='B'){
        $st_grp=" AND st_group='BUSINESS STUDIES'";
    }else{
        $st_grp="";
    }
    //$class_name =$_POST['classname'];
    $sql= "SELECT a.st_id as st_id,a.st_name as st_name,a.st_class as st_class, a.father_mobile as st_mobile ,b.s_l as class_id 
    FROM 
    student_list_ju a
    inner join
    class_list b
    on a.st_class=b.class_name
    WHERE b.s_l IN ($class_name)
    $st_grp
    AND a.active_inactive='ACTIVE'
    GROUP BY a.st_class ASC,
    a.st_group DESC,
    a.st_id ASC
UNION 
SELECT tr_id,teacher_name,designation,mobile,id
FROM teacher_profile
WHERE section IN ($class_name)

    ";




$result = mysqli_query($link,$sql);
$nCount=0;




// echo '<table id="sms-table" class="table table-striped table-responsive"   border="0" width="100%" 
//  cellpadding="5px" style="height: 500px; overflow: auto; font-size: 12px;">';
 

// echo '<tr>
// <th><label class="form-check-label">
//                 <input type="checkbox" id="allCheck" class="checkbox_sms" value="BA" > Check All
//               </label></th>


// <th>ID</th>
// <th>Name</th>
// <th>Class</th>
// <th>Mobile</th>
// </tr>';



while($row = mysqli_fetch_assoc($result)){

	$nCount++;
   //<td>'.$nCount.'</td>
    echo '<tr>
    
    <td><input type="checkbox" id="checkAll" name="selected_id[]" class="checkboxsms" value="'.$row['st_mobile'].'"> </td>
    <td class="st_absent">'.$row['st_id'].'</td>
    <td class="st_absent">'.$row['st_name'].'</td>
    <td class="st_absent">'.$row['st_class'].'</td>
    <td class="st_absent">'.$row['st_mobile'].'</td>
    <td class="st_absent">'.$nCount.'</td>
    </tr>';
}
  
mysqli_close($link);
//echo '</table>';





}
?>

