0

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?

Bruce
  • 3
  • 3
  • 2
    You can't do that. You need to do everything in Javascript. – SLaks Jul 17 '16 at 22:56
  • 2
    Possible duplicate of [Display message before redirect to other page](http://stackoverflow.com/questions/18305258/display-message-before-redirect-to-other-page) – chris85 Jul 17 '16 at 22:57
  • Thanks, both of you. The latter solution had worked. – Bruce Jul 18 '16 at 00:02

0 Answers0