PHP

Isset function on echoing out alerts

  • php

2 comments

Coll 23
4 years ago

if(isset($_POST["submit"])){
    alertWindow('Form Submitted Successfully! We will reply to you within 3-5 working days.');
    echo "";
    // if user click submit, it will clear cookies and redirect them to index.php
   
}
?>

Can i check if the above is acceptable?



Not too sure how can i apply the alertRedirect() with the isset function.

Hi Colleen, because you executed a header("location: ...") right after the alertWindow. So what it does is that it redirects the user away from the page right after your print the alert. So the user won't see the alert and will be redirect.

You can try using the alertRedirect() function instead. That uses JavaScript to show the alert and redirect  the user away after that.