I get this warning that doesn't allow me to continue:
Warning: session_start(): Cannot start session when headers already sent in C:\xampp\htdocs\bancoinfocial\index.php on line 45
Notice: Undefined variable: _SESSION in C:\xampp\htdocs\bancoinfocial\principal.php on line 3
And this is my code:
index.php
<div id="principal" hidden>
<?php
session_start();
require_once("principal.php");
?>
</div>
main.php
<div>
<?php
echo $_SESSION['fullname'];
?>
</div>
That is, I call principal.php from index.php where it is not possible to log in due to headers already sent, even though it is the first instruction that I execute in each invocation of the method session_start()
.