Page 1 of 1

Header Location not the best option

Posted: Wed Feb 03, 2010 7:27 am
by mariolopes
Hi
I need to change between pages and the unique command I know is header (....) . Any other option? Header() as lot of troubles with messagens like headers already sent...
Any other options?
Thank you

Re: Header Location not the best option

Posted: Wed Feb 03, 2010 2:59 pm
by AbraCadaver
If you want to redirect to another page that's about your only option. There is a meta refresh solution but it's not portable and not recommended.

header() doesn't have problems, your script has problems if you output anything and then call header() because headers are sent when you output to the browser and you can't send more headers after the data. That's why they are called "headers".

If your code is correct, headers won't cause any problems. In the rare event in which things may be output before a header call, you can use output buffering.