<?php

session_start(); 
    $u_uname = '';
    if (isset($_COOKIE['auth_token']))
    {
        $u_uname = $_COOKIE['auth_token'];
    }else{
        header("location:../login.php");
    }
    
    
    include('../include/connection.php');
    
    $employmentId = $_GET['employmentId'];
    $empId = $_GET['empId'];
    
    $empTitle = $_POST['empTitle'];
    $empPrevId = $_POST['empPrevId'];
    $empManager = $_POST['empManager'];
    $empDept = $_POST['empDept'];
    $empLocation= $_POST['empLocation'];
    $empHREmail = $_POST['empHREmail'];
    $empHRPhone = $_POST['empHRPhone'];
    $empStartDate = $_POST['empStartDate'];
    $empEndDate = $_POST['empEndDate'];

    $sql = "UPDATE `previousEmployment` SET `empTitle`='$empTitle',`empPrevId`='$empPrevId',`empManager`='$empManager',`empDept`='$empDept',`empLocation`='$empLocation',`empHREmail`='$empHREmail',`empHRPhone`='$empHRPhone',`empStartDate`='$empStartDate',`empEndDate`='$empEndDate' WHERE employmentId = $employmentId ";
    $result = $link->query($sql);
    
    if($result){
        header('Location:../prevEmpDetails.php?status=1&empId='.$empId);
        exit;
    }
?>