<?PHP
	// Retrieving values from textboxes
	include './conn.php';
	session_start();
	$staff_id = $_SESSION['staff_id'];
	$first_name = $_POST['first_name'];
	$middle_name = $_POST['middle_name'];
	$last_name = $_POST['last_name'];
	$password = $_POST['password'];
	$branch = $_POST['branch'];
	$user_type = "Staff";
	

	
	// Sql query
	$sql1 = "UPDATE lms.staff SET first_name = '$first_name', middle_name = '$middle_name', last_name = '$last_name', branch = '$branch' WHERE staff_id = '$staff_id'";
	$sql2 = "UPDATE lms.login SET password = '$password', user_type = '$user_type' WHERE user_id = '$staff_id'"; 
	
	
	// Firing query
	mysqli_query($conn,$sql1);
	mysqli_query($conn,$sql2);
	
	echo 	"<script>
					alert(\"Staff Updated Successfully.\");
				</script>";
	header("Location: search_staff_for_updation.php");
	mysqli_close($conn);
	
	
?>