I have 2 li tags combined with PHP that is used for dictionary purposes:
<li <?php echo "title='".$this->text['tt-statistics']."'" ;?> ><a <?php if($location == "analytics") {echo 'id="current"'; } ?> href="analytics-dash.php"><?php echo $this->text['statistics'];?></a></li>
<li <?php echo "title='".$this->text['tt-logins']."'" ;?> ><a <?php if($location == "settings") {echo 'id="current"'; } ?> href="settings-producer.php"><?php echo $this->text['manage-logins'];?></a></li>
If I put a header() command right after $this->text['statistics']; (at the end of the first li) Like this:
<li <?php echo "title='".$this->text['tt-statistics']."'" ;?> ><a <?php if($location == "analytics") {echo 'id="current"'; } ?> href="analytics-dash.php"><?php echo $this->text['statistics']; header('Location: http://www.example.com/');?></a></li>
<li <?php echo "title='".$this->text['tt-logins']."'" ;?> ><a <?php if($location == "settings") {echo 'id="current"'; } ?> href="settings-producer.php"><?php echo $this->text['manage-logins'];?></a></li>
The header command works fine.
But If i put it right on the start of the second li, like this:
<li <?php echo "title='".$this->text['tt-statistics']."'" ;?> ><a <?php if($location == "analytics") {echo 'id="current"'; } ?> href="analytics-dash.php"><?php echo $this->text['statistics'];?></a></li>
<li <?php header('Location: http://www.example.com/'); echo "title='".$this->text['tt-logins']."'" ;?> ><a <?php if($location == "settings") {echo 'id="current"'; } ?> href="settings-producer.php"><?php echo $this->text['manage-logins'];?></a></li>
It doesn’t work.
I know that header “must be called before any actual output is sent”. But I cant understand why or where am I printing the output that mess up the header() between those 2 places.
The very first character of your example is actually output being already sent.