I am creating a login system for my site and would like to echo the username from the html portions of the pages that users accesses once logged in. I'm able to start sessions and redirct pages correctly, but I'm unable to get the session variable for the username to echo onto the page after login. Below is the code I'm using for the login page. Any suggestions would be appreciated.
<?php
session_start();
$_SESSION['auth'] = 'yes';
$_SESSION['username'] = $userName;
?>
<!DOCTYPE HTML PUBLIC "_//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>SeubsWorld - Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=8"/>
<link href="style.css" media="screen" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Log In</h1>
<div id="content">
<form action="processform.php" method="POST">
<?php error_reporting(E_ERROR | E_WARNING | E_PARSE); ?>
<div>
<?php if ($error['alert'] |= '') {
echo "<div class='alert'>",$error['error_alert'],"</div>";
}
?>
<label for="username">Username: *</label>
<input type="text" name="username" value="<?php echo $input['user']; ?>" >
<div class="error"><?php echo $error['user']; ?></div>
<label for="password">Password *</label>
<input type="password" name="password" value="<?php echo $input['pass']; ?>">
<div class="error"><?php echo $error['pass']; ?></div>
<p class="required">* required fields</p>
<input type="submit" name="submit" class="submit" value="submit">
</body>
</html>