2

How can I move to another page after displaying the JavaScript alert. Thank you, :D What's the next code for this to go to another page?

if(isset ($_POST['reply'])){

    echo "<script>alert('Login to continue.')</script>";

}
Muhammad Hassaan
  • 7,296
  • 6
  • 30
  • 50

3 Answers3

1

Hope you are looking for this

echo "<script>alert('Update Not Successfully');document.location='pagename.php'</script>";

do not forget to write script at start and end point in echo.

Muhammad Hassaan
  • 7,296
  • 6
  • 30
  • 50
Devsi Odedra
  • 5,244
  • 1
  • 23
  • 37
0

You can use javascript below way:

window.location = "http://www.domain.com";

Also you can try with PHP code:

header('Location: targetPage.php');
Chonchol Mahmud
  • 2,717
  • 7
  • 39
  • 72
0

You must use JavaScript confirm and window.location both for it.

var r = confirm("Login to continue.");
if (r == true)
{
    window.location = "http://www.domain.com/agreed.html";
}
else
{
    window.location = "http://www.domain.com/cancelled.html";
}
Muhammad Hassaan
  • 7,296
  • 6
  • 30
  • 50