$cvFilePath = getCVPathByUsername($selectedUsername);
             }
         } else {
             $error = "Only .pdf file type is allowed";
         }
     } else {
         $error = "Select a user first";
     }
 }
 if (isset($_POST['deleteCVFormSubmit'])) {
     if (isset($_SESSION['selectedUsername'])) {
         $selectedUsername = $_SESSION['selectedUsername'];
         if (hasCVUploadedOnce($selectedUsername)) {
             $cvFilePath = getCVPathByUsername($selectedUsername);
             unlink($cvFilePath);
             deleteCVPath($selectedUsername);
             $cvFilePath = getCVPathByUsername($selectedUsername);
             $isCVDeleteSuccess = true;
         } else {
             $isCVDeleteSuccess = false;
         }
     }
 }
 if (isset($_SESSION['selectedUsername'])) {
     $selectedUsername = $_SESSION['selectedUsername'];
     $selectedUserProfileDetails = getProfileDetailsByUsername($selectedUsername);
     $selectedUserEmail = $selectedUserProfileDetails["email"];
     $selectedUserFirstName = $selectedUserProfileDetails["first_name"];
     $selectedUserLastName = $selectedUserProfileDetails["last_name"];
     $selectedUserGender = $selectedUserProfileDetails["gender"];
     $selectedUserAddress1 = $selectedUserProfileDetails["address_line1"];
                    $cvFilePath = getCVPathByUsername($username);
                    unlink($cvFilePath);
                }
                move_uploaded_file($_FILES["cvFile"]["tmp_name"], $finalFilePath);
                manageCV($username, $finalFilePath);
                $cvFilePath = getCVPathByUsername($username);
            }
        } else {
            $error = "Only .pdf file type is allowed";
        }
    }
    if (isset($_POST['deleteCVFormSubmit'])) {
        if (hasCVUploadedOnce($username)) {
            $cvFilePath = getCVPathByUsername($username);
            unlink($cvFilePath);
            deleteCVPath($username);
            $cvFilePath = getCVPathByUsername($username);
            $isDeleteSuccess = true;
        } else {
            $isDeleteSuccess = false;
        }
    }
} else {
    redirect_to("home");
}
?>

<script type="text/javascript" language="javascript">
 
    function hasConfirmDeleteCV(){
		<?php