<?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">Form Editing</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">
                                <input type="text" class="form-control" placeholder="Search for Surname, Form No, Email Address"name="searchtxt" title="Enter name for search " autocomplete="off">
                                <span class="input-group-btn">
                                    <input type="submit" class="btn btn-danger" name="btnsearch" value="Search" id="button-search" title="Search Student">
                                </span>
                            </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>STUDENT ID</th>
                                            <th>FORM NO</th>
                                            <th>SURNAME</th>
                                            <th>OTHER NAMES</th>            
                                            <th>SEX</th>
                                            <th>DEPARTMENT</th>
                                            <th>PHONE</th>
                                         <!--   <th>PROGRAMME</th> -->
                                            <th>STATUS</th>
                                            <th>EDIT</th>
                                        </tr>
                                    </thead>
					<?php
                        $key="";
                        if(isset($_POST['searchtxt']))
                            $key=$_POST['searchtxt'];
                        
                        if($key !="")
                            $sql=mysql_query("SElECT * FROM admitted_student_details_2019 WHERE surname='$key' OR formno='$key' OR email='$key'");
                        else
                         //   $sql=mysql_query("SELECT * FROM admission_students_details LIMIT 2");
                        
                            
                           
                        $i=0;
                        while($row=mysql_fetch_array($sql)){
							$emailS=$row['email'];
                        $i++;
                        $color=($i%2==0)?"lightblue":"white";
                    ?>
                                    <tbody>
                                        <tr >
                                        	<td><?php echo $i;?></td>
                                            <td><?php echo $row['id'];?></td>
                                            <td><?php echo $row['formno'];?></td>
                                            <td><?php echo $row['surname'];?></td>
                                            <td><?php echo $row['othernames'];?></td>
                                            <td><?php echo $row['sex'];?></td>
                                            <td><?php echo $row['department'];?></td>
                                            <td><?php echo $row['phone'];?></td>
                                            
                                            <td><?php echo $row['status'];?></td>
                                            <td><a href="?action=2019_update_student&opr=upd&rs_id=<?php echo $row['id'];?>" title="Update"><img src="images/icon-48-edit.png" /></a></td>
                                        </tr>
                                    </tbody>
                          <?php	
							}														
							?>
                                </table>
                            </div>
                            <!-- /.table-responsive -->
                            
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Account 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>SURNAME</th>            
                                            <th>OTHER NAMES</th>
                                            <th>PHONE</th>
                                            <th>EMAIL</th>
                                        </tr>
                                    </thead>
					<?php
                        $key="";
                        if(isset($_POST['searchtxt']))
                            $key=$_POST['searchtxt'];
                        
                        if($key !="")
                            $sql=mysql_query("SElECT * FROM student_account WHERE email='$emailS'");
                        else
                         //    $sql=mysql_query("SELECT * FROM admission_students_details LIMIT 2");
                        
                            
                           
                        $k=0;
                        while($row=mysql_fetch_array($sql)){
							$cardidS=$row['id'];
							$idS=$row['id'];
                        $k++;
                        $color=($k%2==0)?"lightblue":"white";
                    ?>
                                    <tbody>
                                        <tr >
                                        	<td><?php echo $k;?></td>
                                            <td><?php echo $row['surname'];?></td>
                                            <td><?php echo $row['othernames'];?></td>
                                            <td><?php echo $row['phone'];?></td>
                                            <td><?php echo $row['email'];?></td>
                                        </tr>
                                    </tbody>
                          <?php	
							}
							?>
                                </table>
                            </div>
                            <!-- /.table-responsive -->
                            
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Card 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>CARD SERIAL NUMBER</th>
                                            <th>STATUS</th>
                                            <th>USED BY</th>
                                            <th>LOGIN DATE</th>            
                                        </tr>
                                    </thead>
					<?php
                        $key="";
                        if(isset($_POST['searchtxt']))
                            $key=$_POST['searchtxt'];
                        
                        if($key !="")
                            $sql=mysql_query("SElECT * FROM admission_cards_new WHERE acctbyid='$cardidS' LIMIT 1");
                        else
                         //    $sql=mysql_query("SELECT * FROM admission_students_details LIMIT 2");
                        
                            
                           
                        $c=0;
                        while($row=mysql_fetch_array($sql)){
                        $c++;
                        $color=($c%2==0)?"lightblue":"white";
						$_SESSION['cardidk']=$row['id'];
                    ?>
                                    <tbody>
                                        <tr >
                                        	<td><?php echo $c;?></td>
                                            <td><?php echo $row['serial_no'];?></td>
                                            <td><?php echo $row['status'];?></td>
                                            <td><?php echo $row['usedbyid'];?></td>
                                            <td><?php echo $row['log_time'];?></td>
                                        </tr>
                                    </tbody>
                          <?php	
							}
							?>
                                </table>
                            </div>
                            <!-- /.table-responsive -->
                            
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->

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

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