I have this confusing warning massage that I cannot figure out how to solve because I dont know what is the problem. I have my videoator-a.php file where this line of code:
<?php require_once "esse.php";?>
<?php
require("common.php");
if(empty($_SESSION['username']))
{
header("Location: index.php");
}
?>
Gets in conflict with the line of code thats in the included file esse.php:
<option><?php if(isset($_GET['lang'])){echo $_GET['lang'];}else{?>Language<?php } ?></option>
Note that in esse.php there's a line:
session_start();
(Just think this can help) And when I open videator-a.php page it throws a warning:
Warning: Cannot modify header information - headers already sent by (output started at D:\wamp\www\pollo\esse.php:118) in D:\wamp\www\pollo\videator-a.php on line 6
On line 6 there is:
header("Location: index.php");
and on line 118 in esse.php there is:
<option><?php if(isset($_GET['lang'])){echo $_GET['lang'];}else{?>Language<?php } ?></option>
And if I get modify my videator-a.php file like this:
<?php
require("common.php");
header("Location: index.php");
?>
<?php require_once "esse.php";?>
The warning gets away. Why cant I check if a session exists in both php files? What's wrong here? (Sorry, I am a bit of a boiling kettle)
My question is - why the error ever happens. Because it says - header already sent - but I didint sent ny header in esse.php file. Only checked if a session exists and id so - echo it. PLease, help me to solve the problem. Thanks in advance.