<?php
session_start();
include("dbConfig.php");
if(isset($_SESSION['username']) && isset($_SESSION['name']))
{
    $username=$_SESSION['username'];
    $name=$_SESSION['name'];
}
else
{
     echo '<META http-equiv="refresh" content="0;logout.php">';
}

?><?php
include('dbConfig.php');
             



if(isset($_POST['StaffName'])){
$StaffName=$_POST['StaffName'];
$Group=$_POST['Group'];
$Spec=$_POST['Spec']; 
$FHN=$_POST['FHN']; 
$Contact=$_POST['Contact'];
$EmContact=$_POST['EmContact']; 
$Email =$_POST['Email'];
$dob =$_POST['dob'];
$Gender =$_POST['Gender'];
$Blood =$_POST['Blood'];
$Education=$_POST['Education'];
$Address=$_POST['Address'];
$Address.=", ".$_POST['City'];
$Address.=", ".$_POST['State'];
$Address.=", ".$_POST['Country'];

$Photo=$_FILE['Photo'];
$fileName=$_FILES['Photo']['name'];
                        $fileTmpName=$_FILES['Photo']['tmp_name'];
                        $fileSize=$_FILES['Photo']['size'];
                        $fileError=$_FILES['Photo']['error'];
                        $fileType=$_FILES['Photo']['type'];

                        $fileExt=explode('.',$fileName);
                        $fileActualExt=strtolower(end($fileExt));
                        $allowed=array('jpg','jpeg','png','JPG','JPEG','PNG');

                        if(in_array($fileActualExt, $allowed))
                        {
                            if($fileError ===0){
                                if($fileSize<=3000000){
                                    $PfileNameNew=uniqid('',true).".".$fileActualExt;

    
                                    $fileDestination = 'assets/StaffPhotos/'.$PfileNameNew;
                                    move_uploaded_file($fileTmpName, $fileDestination);  
                                }
                                else{
                                    echo "Your File Size is large";
                                }

                            }else{
                                    echo "Error Uploading File";
                                }
                            
                        }





}
?>

<!DOCTYPE html>
<html>
<head>
  <title>
    
  </title>
  <meta charset="UTF-8">
  <link href="assets/img/favicon.png" rel="icon">
  <link href="assets/img/apple-touch-icon.png" rel="apple-touch-icon">
  <script src='https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<link href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.css'>
<link href='https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css'>
  <!-- Google Fonts -->
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,700,700i|Raleway:300,400,500,700,800|Montserrat:300,400,700" rel="stylesheet">
<link href='https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css'>
<link href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.css'>

  <!-- Vendor CSS Files -->
  <link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <link href="assets/vendor/ionicons/css/ionicons.min.css" rel="stylesheet">
  <link href="assets/vendor/animate.css/animate.min.css" rel="stylesheet">
  <link href="assets/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  <link href="assets/vendor/venobox/venobox.css" rel="stylesheet">
  <link href="assets/vendor/owl.carousel/assets/owl.carousel.min.css" rel="stylesheet">
  <link href="assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
  <script src="https://code.jquery.com/jquery.min.js"></script>
  <script src="jquery.dependent.fields.js"></script>
  <!-- Template Main CSS File -->
  <link href="assets/css/style.css" rel="stylesheet">
  <script src="https://code.jquery.com/jquery.min.js"></script>
<script src="jquery.dependent.fields.js"></script>
</head>
<body>

<section>
	<div class="row">
		<div class="col-md-2"></div>
		<div class="col-md-8">
	            		

	<div class="shadow p-3 mb-5 bg-light rounded">
	<h2>Staff Information</h2>
	<table class="table table-striped">
	<tr>
		<td>Staff Name</td>
		<td><? echo $StaffName;?></td>
	</tr>
	<tr>
		<td>Staff Group</td>
		<td><? echo $Group;?></td>
	</tr>
	<tr>
		<td>Specialisation</td>
		<td><? echo $Spec;?></td>
	</tr>
	<tr>
		<td>Father/Wife/Husband Name</td>
		<td><? echo $FHN;?></td>
	</tr>
	<tr>
		<td>Contact No.</td>
		<td><? echo $Contact;?></td>
	</tr>
	<tr>
		<td>Emergency Contact No.</td>
		<td><? echo $EmContact;?></td>
	</tr>
	<tr>
		<td>Email Id</td>
		<td><? echo $Email;?></td>
	</tr>
	<tr>
		<td>Date of Birth</td>
		<td><? echo $dob;?></td>
	</tr>
	<tr>
		<td>Gender</td>
		<td><? echo $Gender;?></td>
	</tr>
	<tr>
		<td>Blood Group</td>
		<td><? echo $Blood;?></td>
	</tr>
	<tr>
		<td>Education</td>
		<td><? echo $Education;?></td>
	</tr>
	<tr>
		<td>Address</td>
		<td><? echo $Address;?></td>
	</tr>
		<?if($PfileNameNew!=""){
			echo "<tr><td>Patient Photo</td>";
			echo "<td><img src=\"assets/StaffPhotos/$PfileNameNew\" width=\"70px\" height=\"70px\"></td></tr>";
		}
		?>
</table>            
            
<form action="store.php" method="POST">
<input type="hidden" name="StaffName" value="<?php echo $StaffName;?>">
<input type="hidden" name="Group" value="<?php echo $Group;?>">
<input type="hidden" name="Spec" value="<?php echo $Spec;?>">
<input type="hidden" name="FHN" value="<?php echo $FHN;?>">
<input type="hidden" name="Contact" value="<?php echo $Contact;?>">
<input type="hidden" name="EmContact" value="<?php echo $EmContact;?>">
<input type="hidden" name="Email" value="<?php echo $Email;?>">
<input type="hidden" name="dob" value="<?php echo $dob;?>">
<input type="hidden" name="Gender" value="<?php echo $Gender;?>">
<input type="hidden" name="Blood" value="<?php echo $Blood;?>">
<input type="hidden" name="Address" value="<?php echo $Address;?>">
<input type="hidden" name="Education" value="<?php echo $Education;?>">
<input type="hidden" name="Photo" value="<?php echo $PfileNameNew;?>">
	 <button type="submit" class="btn btn-primary">Confirm and Save</button>
	 <button type="button" class="btn btn-info" onclick="history.back()">Cancel</button>
</form>
		</div>
		<div class="col-md-2"></div>
	</div>
</div>
</section>
 <script src='https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js'></script>
  <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
  <script src="assets/vendor/jquery/jquery.min.js"></script>
  <script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="assets/vendor/jquery.easing/jquery.easing.min.js"></script>
  <script src="assets/vendor/php-email-form/validate.js"></script>
  <script src="assets/vendor/wow/wow.min.js"></script>
  <script src="assets/vendor/venobox/venobox.min.js"></script>
  <script src="assets/vendor/owl.carousel/owl.carousel.min.js"></script>
  <script src="assets/vendor/jquery-sticky/jquery.sticky.js"></script>
  <script src="assets/vendor/superfish/superfish.min.js"></script>
  <script src="assets/vendor/hoverIntent/hoverIntent.js"></script>
  <script src="assets/vendor/isotope-layout/isotope.pkgd.min.js"></script>
  <script src="assets/js/main.js"></script>
</body>
</html>
