Session variables lost

Why session variables are lost when redirecting to an url using the header function?

This happens usually in windows, if only ONE blank space or character is founded in a php file before the php symbol

That is why it will show the error: header have already been sent..


So, CLEAN up your code and don't live any blank space or any other character!


You can use emacs or vim, sometimes it is a file with bom (byte order mark) and you can see any hidden character with these editors.

Happy coding