<?php
	error_reporting(0);
	define('INCLUDE_CHECK',true);
	session_start();
	require ('classes/config1.php');
	require_once('classes/session.php');
	
	
?>
<title>OSCOTECH, ESA-OKE :: Admin-Dashboard > Form Editing</title>


        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">Applicant's List</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
                <div class="col-lg-12">
                	<div class="well" style="background:#FFF">
                    	<form method="post" action="" role="form">                        	
                        	<div class="form-group input-group">
                        	<table class="table table-bordered table-hover">
                            	<tr>
                                	<td>
                                        <select name="department" id="department"  class="form-control">
                                          <option value="">-- Select Department -- </option>
                                            <?php 
                                                    $getdept = mysql_query("SELECT dept FROM department");
                                                    while($row = mysql_fetch_array($getdept)){
                                                ?>
                                                    <option value="<?php echo $row['dept'] ?>"><?php echo $row['dept']?></option>
                                                <?php
                                                    }
                                            ?>
                                        </select>
                                	</td>
                                    <td>
                                    	<select name="level" class="form-control" id="level">
                                            <option value="">--Select level--</option>
                                            <option value="Cert.">Certificates</option>
                                            <option value="Adv. Cert.">Advance Certificates</option>
                                            <option value="ND">National Diploma</option>
                                            <option value="HND">Higher National Diploma</option>
                                             <option value="PGD">Post Graduate Diploma</option>
                                        </select>
                                    </td>
                                    <td>
                                    	<select name="progtype" class="form-control" id="progtype">
                                            <option value="">--Select Session--</option>
                                            <option value="NDPU">Post UTME</option>
                                            <option value="NDDPT">Daily-Part-Time</option>
                                            <option value="HND">Full Time HND</option>
                                             <option value="PGD">PGD</option>
                                        </select>
                                    </td>
                                    <td>
                                    	<select name="session" class="form-control" id="session">
                                            
                                            <option value="2019/2020">2019/2020</option>
                                            <option value="2020/2021">2020/2021</option>
                                            <option value="2021/2022">2021/2022</option>
                                        </select>
                                    </td>
                                	<td>
                                        <span class="input-group-btn">
                                            <input type="submit" class="btn btn-danger" name="btnsearch" value="Search" id="button-search" title="Search Student">
                                        </span>
                                    </td>
                             	</tr>
                            </table>
                            </div>
                        </form>
                    </div>
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Student Details Table
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <div class="dataTable_wrapper">
                                <table class="table table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th>S/N</th>
                                            <th>FORM NO</th>
                                            <th>SURNAME</th>
                                            <th>OTHER NAMES</th>            
                                            <th>SEX</th>
                                            <th>PHONE</th>
                                            <th>PROGRAMME</th>
                                        </tr>
                                    </thead>
					<?php
							$level=$_POST['level'];
							$sek= $_POST['session'];
							$department=$_POST['department'];
							$progtype=$_POST['progtype'];
							
							echo $department,$sek;
							
							//,$level, $progtype;
							
							//	if($department=="" || $progtype=="" || $session=="" || $level=="")
							//	echo "<span style=color:#f00;>No Record to Display</span>";
						//	else
                        if ($sek=="2020/2021"){
							if ($progtype=="NDDPT")
							{
							$sql=mysql_query("SElECT student_account.id,student_account.surname, student_account.othernames,student_account.email, student_account.progtype, student_account.level,
							     form_data.phone,form_data.sex,form_data.acc_id,form_data.passport,form_data.id
                             	FROM  student_account
                             	JOIN form_data
                                ON student_account.id=form_data.acc_id
                                AND student_account.department='$department'
                                AND form_data.passport LIKE '%DP%'");
							}elseif ($progtype=="HND")
							{
							    $sql=mysql_query("SElECT student_account.id,student_account.surname, student_account.othernames,student_account.email, student_account.progtype, student_account.level,
							     form_data.phone,form_data.sex,form_data.acc_id,form_data.passport,form_data.id
                             	FROM  student_account
                             	JOIN form_data
                                ON student_account.id=form_data.acc_id
                                AND student_account.department='$department'
                                AND form_data.passport LIKE '%FT%'");

                            }elseif ($progtype=="PGD")
							{
							    $sql=mysql_query("SElECT student_account.id,student_account.surname, student_account.othernames,student_account.email, student_account.progtype, student_account.level,
							     form_data.phone,form_data.sex,form_data.acc_id,form_data.passport,form_data.id
                             	FROM  student_account
                             	JOIN form_data
                                ON student_account.id=form_data.acc_id
                                AND student_account.department='$department'
                                AND student_account.progtype='PGD'
                                AND form_data.passport LIKE '%FT%'");
							}elseif ($progtype=="NDPU")
							{
							    $sql=mysql_query("SElECT student_account.id,student_account.surname, student_account.othernames,student_account.email, student_account.progtype, student_account.level,
							     form_data.phone,form_data.sex,form_data.acc_id,form_data.passport,form_data.id
                             	FROM  student_account
                             	JOIN form_data
                                ON student_account.id=form_data.acc_id
                                AND student_account.department='$department'
                                AND form_data.passport LIKE '%PU%'");
							}
                        }
                         
                          elseif ($sek=="2021/2022") { 
                          
                       	if ($progtype=="NDDPT")
							{
							$sql=mysql_query("SElECT student_account.id,student_account.surname, student_account.othernames,student_account.email, student_account.progtype, student_account.level,
							     form_data21.phone,form_data21.sex,form_data21.acc_id,form_data21.passport,form_data21.id
                             	FROM  student_account
                             	JOIN form_data21
                                ON student_account.id=form_data21.acc_id
                                AND student_account.department='$department'
                                AND form_data21.passport LIKE '%DP%'");
                                
							}elseif ($progtype=="HND")
							{
							    $sql=mysql_query("SElECT student_account.id,student_account.surname, student_account.othernames,student_account.email, student_account.progtype, student_account.level,
							     form_data21.phone,form_data21.sex,form_data21.acc_id,form_data21.passport,form_data21.id
                             	FROM  student_account
                             	JOIN form_data21
                                ON student_account.id=form_data21.acc_id
                                AND student_account.department='$department'
                                AND form_data21.passport LIKE '%FT%'");

                            }elseif ($progtype=="PGD")
							{
							    $sql=mysql_query("SElECT student_account.id,student_account.surname, student_account.othernames,student_account.email, student_account.progtype, student_account.level,
							     form_data.phone,form_data.sex,form_data.acc_id,form_data.passport,form_data.id
                             	FROM  student_account
                             	JOIN form_data
                                ON student_account.id=form_data.acc_id
                                AND student_account.department='$department'
                                AND student_account.progtype='PGD'
                                AND form_data.passport LIKE '%FT%'");
							}elseif ($progtype=="NDPU")
							{
							    $sql=mysql_query("SElECT student_account.id,student_account.surname, student_account.othernames,student_account.email, student_account.progtype, student_account.level,
							     form_data21.phone,form_data21.sex,form_data21.acc_id,form_data21.passport,form_data21.id
                             	FROM  student_account
                             	JOIN form_data21
                                ON student_account.id=form_data21.acc_id
                                AND student_account.department='$department'
                                AND form_data21.passport LIKE '%PU%'");
							}
                            
                          }
                       
                        $i=0;
                        while($row=mysql_fetch_array($sql)){
							$acc_id=$row['acc_id'];
                        $i++;
                        $color=($i%2==0)?"lightblue":"white";
                    ?>
                   
                                    <tbody>
                                        <tr >
                                        	<td><?php echo $i;?></td>
                                           <td><?php echo trim($row['passport'],".jpg , .jpe, .png");?> </td> 
                                            <td><?php echo $row['surname'];?></td>
                                            <td><?php echo $row['othernames'];?></td>
                                            <td><?php echo $row['sex'];?></td>
                                            <td><?php echo $row['phone'];?></td>
                                            <td><?php echo $row['level'];?></td>
                                        </tr>
                                    </tbody>
                          <?php	
							}														
							?>
                                </table>
                            </div>
                            <!-- /.table-responsive -->
                            
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->

        </div>
        <!-- /#page-wrapper -->
        

    </div>
    <!-- /#wrapper -->
    
