<?php 
include("../connection.php");
include("../user.php");
?>
<link rel="stylesheet" href="../css/sweet-alert.css" /> 
<?php
$cur_date=date('Y-m-d H:i:s');
$user=$_SESSION['user'];
if(isset($_POST['submit'])) {
    $branch_id = $_POST['branch_id'];
    $branch_name = $_POST['branch_name'];
    $division = $_POST['division'];
    $tower = $_POST['tower'];
    // $room_name = $_POST['room_name'];
    // $shelf_name = $_POST['shelf_name'];
    // $rack_name = $_POST['rack_name'];
    // $item_name = $_POST['item_name'];
    // $measurement_type = $_POST['measurement_type'];
    // $measurement = $_POST['measurement'];

    $branch_update = "UPDATE branch_master SET 
                        branch_name='$branch_name',
                        division='$division',
                        tower='$tower'
                     WHERE id='$branch_id'";
    
                        // room_name='$room_name', 
                        // shelf_name='$shelf_name', 
                        // rack_name='$rack_name', 
                        // item_name='$item_name',
                        // measurement_type='$measurement_type', 
                        // measurement='$measurement' 
    mysqli_query($con, $branch_update);
    
    // Redirect or show success message
}

if($branch_update)	{	?>
	<script>
	setTimeout(function() {
        swal({
            title: "Successfully",
            text: "updated!",
            type: "success"
        }, function () {
                  window.location = "branch_master_view.php";
		  
        });
    }, 100);
</script>  
  <?php
	}	
	else
	{
	?>
	<script>
    setTimeout(function() {
        swal({
            title: "Not",
            text: "Branch Created!",
            type: "error"
        }, function() {
         window.location = "branch_master_view.php";
        });
    }, 100);
</script> 	  
	<?Php
	}	
?>

	
	
	<script src="../js/sweet-alert.js"></script>

