$_POST['pid'], "firstname" => $_POST['firstname'], "lastname" => $_POST['lastname'], "email" => $_POST['email'], "custom_field_1" => $_POST['designation'], "custom_field_2" => $_POST['department'], "telephone" => $_POST['telephone'] ]; $id =$_SESSION["PID_TEST"]; //from the user_details_function page we re use this for every functionality.// //----------------------------API CALL--------------------// $jsonFilePath = __DIR__ . '/../urls/api_endpoints.json'; $jsonData = file_get_contents($jsonFilePath); $endpoints = json_decode($jsonData, true); $url = $endpoints['delete_user'] . $id; //----------------------- ENDS HERE-------------------------// $response = make_patch_request($url, $data); if ($response === FALSE) { $response = json_encode(['status' => 'error', 'message' => 'An error occurred']); } $response_data = json_decode($response, true); if ($response_data['status'] === 200) { //echo ''; $_SESSION['message']="User Updated Successfully $id"; $redirect_page="../user/userlist.php"; } elseif ($response_data['status'] === 401) { $_SESSION['message'] = 'User not Updated '; $redirect_page="../user/user_edit.php"; } else{ $_SESSION['message'] = 'User not Updated'; $redirect_page="../user/userlist.php"; } } else { header('Location: ../index.php'); exit(); } } ?> Create User