At the bottom of your site you have to put the following sentence:
<?php session_start(); ?>
I clearly assume that the variable $_SESSION
is assigning it from a login.
Your html code if it should be the same as you have it:
<header class='main' id='h1'>
<span class="right"><a href="layout.html">LogOut</a> </span>
<?php echo $_SESSION['login']; ?>
<h2>Quiz: crazy questions</h2>
</header>
Example:
<?php session_start();
$_SESSION['login'] = "wilson";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<header class='main' id='h1'>
<span class="right"><a href="layout.html">LogOut</a> </span>
<?php echo $_SESSION['login']; ?>
<h2>Quiz: crazy questions</h2>
</header>
</body>
</html>
You can check that your variable $_SESSION
exists with the following conditional:
if(!isset($_SESSION["login"]))
{
echo "No existe o no esta seteada la SESSION";
die();
}else {
echo "La SESSION login si existe $_SESSION['login']";
}
That conditional you should put it just after of session_start();
, always goes first of all session_start();