Reputation: 15
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>";
}
Upvotes: 2
Views: 90
Reputation: 5322
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.
Upvotes: 1
Reputation: 7672
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";
}
Upvotes: 0
Reputation: 2735
You can use javascript below way:
window.location = "http://www.domain.com";
Also you can try with PHP code:
header('Location: targetPage.php');
Upvotes: 0