<?php 
    session_start();
    if(!$_SESSION['id']){
        header('location:index.php');
    }
      require_once '../system/conn.php';
?>
<?php
if(isset($_POST["submit"]))
{
  $ename=  $_POST['ename'];
  $branch1 = $_POST['sitename']; 
  //echo $ename,$branch1,$branch;

    $a=1;
    $stmt = $conn->prepare("SELECT * FROM `emp_details` where `e_id`='$ename'  ");
    $stmt->execute();
    $users = $stmt->fetchAll();
    foreach($users as $user) 
    {
     if($users){
        $query1 = " UPDATE `emp_details` SET `branch`='".$branch1."' WHERE e_id= '".$ename."' and branch ='".$user['branch']."' ";
        $statement1 = $conn->prepare($query1)->execute($data); 
        //print_r($query1);exit;
        echo "<script>window.location.assign('branch-transfer.php')</script>";
       
       
$a++; } } }?>