<?php 
require_once("../includes/initialize.php");
session_start();
$fo = $_SESSION["$fo"];
$faculty_dept = ONLINEPAY:: showdept_byf($fo);
$allsession = ONLINEPAY:: showsession();
$allstates = ONLINEPAY:: get_state();
$semesters = ONLINEPAY:: showsemester();


if (isset($_POST['search']))
{
    $state = $_POST['state'];
    $lev = $_POST['level'];
    $prog = $_POST['programme'];
    
    // if (isset($_POST['state']))
    // {
        if($lev != "" || $prog != "" || $state !="")
        {
            $get_state = ONLINEPAY:: state_lga($state,$lev,$prog);
        }
    // }
    
    if ($lev == 'ND' && $prog == 'PU')
    {
        $msg = 'National Diploma On Full-Time Programme';
    }
    elseif ($lev == 'ND' && $prog == 'DP')
    {
        $msg = 'National Diploma On Daily Part-Time Programme';
    }elseif ($lev == 'HND' && $prog == 'FT')
    {
        $msg = 'Higher National Diploma On Full-Time Programme';
    }elseif ($lev == 'HND' && $prog == 'DP')
    {
        $msg = 'Higher National Diploma On Daily Part-Time Programme';
    }
    
}

$count=0;
?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="description" content="" />
    <meta name="author" content="" />
	<title>Registered Students</title>
	
  <!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>  -->
           <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />  
           <!--<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script> -->
           <!--<script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>            -->
           <link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css" />
           
           
  <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.flash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.print.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"/>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.5.2/css/buttons.dataTables.min.css"/>
</head>
   <body>       
		<div class="container" align="center">
			<h2 align="center">STATE STUDENTS<?php echo $fo;?> </h2><br/>
			    <form method="post">
			        <div class="form-group input-group" align="center">
			            <table class="table table-bordered table-hover" align="center">
                        	<tr>
                            	<td>
                					<select name="state" id="state" class="form-control action" style="width:200px">
                						<option value="">Select State</option>
                							<?php foreach($allstates as $states){?>
                							<option value="<?php echo $states->state;?>"><?php 
                							echo strtoupper($states->state);?></option> <?php }?>
                					</select>
            					</td>
            					<td>
                                	<select name="level" id="level" class="form-control action" style="width:120px" required>
                						<option value="">Select Level</option>
                						<option value="ND">ND</option>
                	                    <option value="HND">HND</option>		
                					</select>
                                </td>
                                <td>
                    				<select name="programme" id="programme" class="form-control action" style="width:120px" required>
                    					<option value="">Select Programme</option>
                    					<option value="DP">Daily-PartTime</option>
                                        <option value="FT">Full-Time(HND)</option>
                                        <option value="PU">Full-Time(ND)</option>
                    				</select>
                    			</td>
                					<td>
                					    <div class="col-md-4">
                                            <input type="submit" name="search" id ="search" value="Search" class="btn btn-info" />
                                        </div>
                					</td>
                					<!--<td>-->
        					        <!--    <input type="submit" name="Print_pdf" id ="Print_pdf" class="btn btn-danger" value="Print PDF" />-->
                					<!--</td>-->
        					</tr> 
                        </table>
					</div>
                
                     </form>
                      <div class="table-responsive" align="center">
                     <?php
        
        echo '<table id="mytable" class="table table-striped table-bordered">
            <thead>
                  <tr>
                      <th>S/N</th>  
                      <th>FORM NO</th>
                      <th>SURNAME</th>     
                      <th>OTHER NAMES</th>
                      <th>DEPARTMENT</th>
                      <th>FACULTY</th>
                      <th>STATE</th>
                      <th>LGA</th>
                      <th>GENDER</th>
                      <th>LEVEL</th>
                      <th>DOB</th>                       
                  </tr>
            </thead>';
    		foreach($get_state as $row) 
            {
                $formno = $row->formno;
                $surname = $row->surname;
                $othernames = $row->othernames;
                $dept = $row->department;
                $faculty = $row->faculty;
                $state = $row->state;
                $lga = $row->lga;
                $sex = $row->sex;
                $level =$row->level;
                $dod=$row->dob;
                echo '<tr>'
        				.'<td>'.++$count.'</td>'
        				.'<td>'.$formno.'</td>'
        				.'<td>'.$surname.'</td>'
        				.'<td>'.$othernames.'</td>'
        				.'<td>'.$dept.'</td>'
        				.'<td>'.$faculty.'</td>'
        				.'<td>'.$state.'</td>'
        				.'<td>'.$lga.'</td>'
        				.'<td>'.$sex.'</td>'
        				.'<td>'.$level.'</td>'
        				.'<td>'.$dod.'</td>'
        			.'</tr>'; 
            }
    
          '</table>'
          
?>
        </div>
    </div>
    </body>
</html>

<script>
 $(document).ready(function(){
     $('#mytable').DataTable( {
        dom: 'Bfrtip',
        buttons: [{
            // 'copy', 'csv', 'excel', 'pdf', 'print',
            extend:'print',
            autoPrint: true,
                title: 'BURSARY AWARD FOR 2018/2019 STUDENT (OGUN STATE) LIST',
            
            
            
            
        }]
    });
})
</script>  


