I want to show a toaster notification message (such as Logged in, redirecting...
), wait 2 seconds and then redirect. The code is the following:
echo "<script>Materialize.toast('Logged in!', 7000, 'rounded')</script>";
sleep(2);
header('Location: sample.php');
However, the only thing that happens is the script waits 2 secs before it redirects. The javascript is not executed. Any ideas?