Warning: Cannot modify header information - headers already sent happen if there is any output appear before Header. Below are 3 common factors that will cause the warning :

Factor 1 : There is spacing before or after php tag, the spacing will appear before header, so the warning will appears. For example :

Solution : Delete the spacing before <?php

Factor 2 : The included file is above header, and the included file has html output. For example :

If connection.php has html output, then the warning will appears.
Solution : Move the included file code, put it below </head>.

Factor 3 : You set $_SESSION['username'] = $username; before header('Location: http://localhost/plekz/home.php');
Solution : You can add <?php ob_start();?> on the most top of page to buffer the output. When output buffering is active, no output is sent from the script (other than headers), instead the output is stored in an internal buffer. You can add <?php ob_flush(); ?> at the most bottom of page to clear away the contents of buffer.

Posted by Zac1987 on 14 October, 2011


Enter your email address:

Subscribe in a reader

Follow zac1987 on Twitter

Chatting Box


If you feel my website is informative and it is useful for you, please donate some money to support me or buy me a drink. I will continues this good works. Thank you.