PHP - header (redirection) problem - Asked By Olusegun A. on 18-Dec-09 04:54 PM

Hello There,

Am having problem with the header in my files. I have a login file which will direct members to their page using header() if their login info is correct. for my header() to function, i uploded

<? PHP_FLAG output_buffering on ?>

but when it filed i uploded

<? output_buffering on ?>

but still my login file is still giving me

Warning: Cannot modify header information - headers already sent by (output started at /home/peoplefi/public_html/adminarea/login.php:9) in /home/peoplefi/public_html/adminarea/login.php on line 42

please what do i do?


There could be two possible problems. - [)ia6l0 iii replied to Olusegun A. on 18-Dec-09 10:24 PM

a) This error typically happens when you have whitespaces before the <?php node or after the ?> section in your php file. You can see if the spaces exist, and delete them.And the file you have to edit is in your error message. The file is login.php, and line number 9 to be precise.
(output started at /home/peoplefi/public_html/adminarea/login.php:9) 

b) And make sure you place the statements like "<? output_buffering on ?>" at the top of the page, and "<? output_buffering off ?>" at the bottom of the page. The reason being that the headers such as these should be parsed before any html content on the page. 

Hope this helps.