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>";

}
Hassaan
  • 6,770
  • 5
  • 29
  • 47

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.

Hassaan
  • 6,770
  • 5
  • 29
  • 47
Devsi Odedra
  • 5,071
  • 1
  • 21
  • 33
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,891
  • 5
  • 33
  • 68
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";
}
Hassaan
  • 6,770
  • 5
  • 29
  • 47