I am trying to display the alert statement once insert is done in mysql database. However, it would insert and immediately redirect to the webpage. It would not display anything between that ? Is there a better way to display message then redirect ? I even tried sleep function.
mysqli_query($con,"INSERT INTO invite_email (email) VALUES ( '".trim($email)."') ");
echo "<script> alert(\"Congratulations! We will contact you soon when the app is launched \") </script>";
mysqli_close($con);
echo " Please wait you will now be redirected to www.xyz.com website";
sleep(5);
header("Location: http:/www.xyz.com");
exit;