$_SESSION['pid'], "firstname" => $_POST['firstname'], "lastname" => $_POST['lastname'], "email" => $_POST['email'], "custom_field_1" => $_POST['designation'] // "custom_field_2" => $_POST['department'], ]; $response = make_post_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'] === 201) { //echo ''; $_SESSION['message']="User Created Successfully"; $redirect_page="../user/create_user_password.php"; } elseif ($response_data['status'] === 409) { $_SESSION['message'] = 'User not created . User already exists'; $redirect_page="../user/createuser.php"; } else{ $_SESSION['message'] = $response_data['']; $redirect_page="../user/createuser.php"; } } else { header('Location: ../index.php'); exit(); } } ?> Create User