Possible Duplicate:
Headers already sent by PHP
I've been using the header("Location: ..") command everwhere in my PHP files. Usually, I would run several checks (if / else) and then simply redirect the user if all the info is correct or send them somewhere else if it isn't.
Header has been used even after I echoed and in between html tags. Everything worked. I never knew there were limitations anyway, I thought I can use it everywhere..
Today I fiddled around a bit with the header tags and suddenly those warning messages kept popping up in my log files and things stopped working.
So I have two questions:
1) What is the correct approach to serving the correct views? Should I rather conditionally include PHP HTML code in the same file?
2) Why does it work in some cases? For example I have my logginIn() function which is called AFTER html and input fields etc have already been shown.. yet it works.