<?php
 	session_start(); 

	if(!isset($_SESSION['tulsilogin']))
	{
		header('Location: index.php');
		return;
	}

$_SESSION['_token']=bin2hex(openssl_random_pseudo_bytes(16));

	include("connect.php");

	$branchmid=$_POST['branchmid'];
	
	$branchname=$_POST['branchname'];
	
	$branchaddress=$_POST['branchaddress'];
	
	$cname=$_POST['countrymid'];
	
	$sname=$_POST['statemid'];
	
	$ciname=$_POST['citymid'];
	
	
	
	$branchphone=$_POST['branchphone'];
	
	$branchmobile=$_POST['branchmobile'];
				
	$branchemail=$_POST['branchemail'];
				
	$branchskype=$_POST['branchskype'];
				
	$branchwhatsapp=$_POST['branchwhatsapp'];

	$branchhead=$_POST['branchhead'];
				
	$branchheadcontact=$_POST['branchheadcontact'];
				
	$branchnote=$_POST['branchnote'];
	
	$tt="";
	/* if(empty($_FILES['attechment']['name']) == false  )
	{
		$attechment = date("YmdHis").$_FILES['attechment']['name'];
		$path = "docs/";
		move_uploaded_file( $_FILES['attechment']['tmp_name'], $path ."/". $attechment );
	
		$tt = ",attechment='$attechment' ";
	} */

	

	 $eve = "update res_branch_master set branchname ='$branchname' , branchaddress = '$branchaddress', countrymid = '$cname', statemid = '$sname', citymid= '$ciname',  branchphone = '$branchphone', branchmobile= '$branchmobile', branchemail= '$branchemail', branchskype= '$branchskype', branchwhatsapp= '$branchwhatsapp', branchhead= '$branchhead',branchheadcontact= '$branchheadcontact', branchnote= '$branchnote' $tt where branchmid='$branchmid'";
	

	if ($conn->query($eve) === TRUE)

	{		

		$_SESSION['msg'] = "branch Record Updated succesfully";

		header('Location: branch.php');		

	} 

	else 

	{

			

		$_SESSION['msg'] = "Error";

		header('Location: branch.php');

	}

?>