So far, the code for my index.php page looks like this:
Code: Select all
<?php session_start();
// Store session data.
$_SESSION['userName']=userName;
?>
<html>
<head>
<title>Log in</title>
</head>
<body>
<h1>Log In</h1>
<form action="home.php" method="post">
Name: <input type="text" name="userName" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
Code: Select all
<?php session_start();
// register session variables
session_register('userName');
// store posted values in the session variables
$_SESSION['userName']=$_POST['userName'];
?>
<html>
<head>
<title>Home</title>
</head>
<body>
<h1>Home</h1>
<?php
Welcome echo $_SESSION["userName"]; ?>!
<?php
Thanks in advance!