<?php
// array for JSON response
$response = array();
$response["list"] = array();

require_once __DIR__ . '/db_config.php';

if (isset($_POST['companyname']) && isset($_POST['employeemailid']) && isset($_POST['leavetype']) && isset($_POST['appliedateandtime']) ) {
    
    $companyname= $_POST['companyname'];
    $employeemailid= $_POST['employeemailid'];
    $leavetype= $_POST['leavetype'];
    $appliedateandtime= $_POST['appliedateandtime'];
    $con = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD,DB_DATABASE) or die(mysql_error());

    $query = "UPDATE leavetable SET deleted = 'Yes' WHERE ( companyname = '$companyname'  AND employeemailid= '$employeemailid' AND leavetype= '$leavetype' AND appliedateandtime= '$appliedateandtime' )";
    
    $result = mysqli_query($con,$query);
      
    if ($result) {
        $response["s"] = 1;
    }else{
        $response["s"] = 0;

    }
}
    echo json_encode($response);

?>