'how to link my sweetalert to another page in php echo tag?
I'm using sweet alert to send the user a warning message that show to them that the information insert is not valid in PHP echo. I want the "okay" button link to the desire page but it just could not work. my developer console shows the error of login.php:29 Uncaught TypeError: Cannot read properties of undefined (reading 'then') but I have no idea how can I make this work. I spent hours searching here and there but it just don't. Anyone who lend me a helping hand will be truly appreciated. Thanks.
Below are my codes:
if (isset($_POST['login'])) {
$email = $_POST['email'];
$user_password = $_POST['user_password'];
$sql = "SELECT * FROM users WHERE user_phone = '$email' OR username = '$email' ";
$query = $conn->query($sql);
if ($query->num_rows < 1) {
echo '<script> swal({
title: "Wrong information",
text: "Sorry, your login information is not in our system. Please check your username/email correctly.",
confirmButtonText: "Okay"}).then(function() {
window.location = "../login/index.php";
});
</script>';
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
