попробуй js:
<button type="button" onclick="logout('<?php echo $SESSION['user']['userId'] ?> ')" class="btn-danger">logout</button>
function logout(id) {
swal({
title: "Do you want to logout this Account?",
type: "error",
showCancelButton: true,
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes!",
cancelButtonText: "No",
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
if (isConfirm) {
userLogout(id);
}
});
}
function userLogout(id) {
$.post(base_url + "fileName/method_name", {id: id}, function (data) {
if (data === "1") {
}
else if (data === "0") {
swal("", "Error to logout user.", "warning");
} else {
swal("", data[0], "error");
}
});
}