Skip to content
Advertisement

Alternative header in php

Is there’s an alternative way to the header in PHP to redirect the page? Because I can’t write any statement before the header. Snippet:-

echo "code";
header ("location: page.php");

Advertisement

Answer

There are different ways to do so. – You can set delay in your code so that that much amount of time the page stops on that page and after that it will execute next line, for that you can use sleep ( int $seconds )

  • You can write

    window.alert(“your message”);

so it will display your message in alert popup and once you will confirm it will execute after lines.

  • You can also set your message in some session variable and after redirecting your page just write down your message from the session variable with some dialogbox, and when it will appear clear your session variable.
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement