<?php
include('config.php');
if($_SERVER["REQUEST_METHOD"] == "POST") {
        // username and password sent from form 
		$ID = mysqli_real_escape_string($db,$_POST['ID']);
        $fileName = mysqli_real_escape_string($db,$_POST['att_file']);
        $upd_attached_file = "None";

        $sql = "UPDATE requirements Set `Attached_File` = 'None' WHERE ID='$ID'"; 

        $result = mysqli_query($db,$sql);
        // If result matched atleast one, table row must be 1 row
            if($result) {
                unlink('attached_files/'.$fileName);
                echo '<script>alert("Attached file was removed successfully!");</script>';
                header("location: assignments.php?ID=".$ID."");
                exit();
            }else {
            $error = "Failed to update!";
            }
    }
    ?>