You cannot use header()
once text has been output to the browser. As your header.php
include presumably outputs HTML, header()
cannot be used.
You can solve this in a couple ways:
- Move the if statement above the header include (this won’t work, as you’ve indicated in comments that
header.php
sets the uid session and other vital stuff). - Call
ob_start()
at the top of the script to buffer the output.