Hi, Is there a way or a different function that would allow me to send the user to another page. (to my understanding, header location can only be used before output and is usless for my script) thanks.
The easiest way would be with something like Java, as php is run before the page is displayed. The only way i can think of doing it with php is to refresh/reload the page and then redirect.
<meta http-equiv content="timeinseconds;url=redirect url here"> or <script type="text/javascript"> <!-- window.location = "redirect url here" //--> </script>
For PHP... before you've written to the page: <?php header("Location: http://www.example.com/");?> Code (markup): You said that it is useless because you send output too soon... couldn't you possibly check if you must redirect before any output and then redirect right away? Javascript is not always the best way because you can't be guaranteed that your user has it enabled, although the vast majority do.
Use buffered output as bohra said earlier, its the only way through which you can call the header function later.