This is not a duplicate, my question is specifically about the br tag, not the 'headers already sent' error.
I have a PHP redirect setup to redirect users who are not logged in to the login page, this is creating a "cannot modify header information" error because for some reason a
is on line 1 of the source code (when viewing source in browser) but I have no idea why!
The source code for the index.php is below:
<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at /home/webuser/public_html/beta/admin/index.php:1) in
<b>/home/webuser/public_html/beta/admin/inc/header.php</b> on line <b>3</b>
<br />
The code for the index.php is below, I deleted everything except what is below from the page to ensure it wasn't anything on that page.:
<?
include "inc/header.php";
?>
The code for the header.php is below, I deleted everything except what is below from the page to ensure it wasn't anything on that page.:
<?
if ($login == 0) {
header ("location:login?error[]=You must login to view this page!");
}
?>
As you can see, the br tag isn't anywhere on my header.php or index.php so I have no idea where it is coming from. Even weirder, the header.php is included in my other pages and they do not experience the issue. Plus, once logged in, the issue isn't there and the br tag doesn't exist.
Any ideas?
EDIT: I have now deleted everything from the index.php page and ONLY had the following:
<?php header("location:login?error[]=You must login to view this page!"); ?>
Issue still occurs. No idea why. Created a new page and done the exact same, issue didn't occur.
EDIT 2: Issue is now RESOLVED. No idea what it was, I copied the content of index.php, deleted the file, created a new index.php, pasted the content back in and the error did not occur. Very weird indeed.
` conditionally based certain content types being written out. Look for perhaps `echo
` or similar. – Alexander Staroselsky Jul 13 '15 at 19:56
and
with no results. – user3207807 Jul 13 '15 at 20:08