<?php
include("config.php");
	if($_SERVER["REQUEST_METHOD"] == "POST") {
		// username and password sent from form 			
		$ID = mysqli_real_escape_string($db,$_POST['ID']);
		$status = mysqli_real_escape_string($db,$_POST['status']);
		$sql = "UPDATE tasks Set `File_Status` = '$status' WHERE ID='$ID'"; 
				
		$result = mysqli_query($db,$sql);
			// If result matched atleast one, table row must be 1 row			
			if($result) {
				echo '<script>alert("Document was approved successfully!");</script>';
				echo '<script>document.location = "task_main-page.php"</script>';
				exit();
			}else {
				echo '<script>alert("Failed to approved document! Please check your mysql connection!");</script>';
				echo '<script>document.location = "task_main-page.php"</script>';
			}
		}    
?>