Tyler's Sessions Example
CODE FOLLOWS
<?php
session_name("tyler-session");
session_start();
include("../includes/header.php");
error_reporting(E_ALL);
$name = isset($_SESSION['name']) ? $_SESSION['name'] : '';
$age = isset($_SESSION['age']) ? $_SESSION['age'] : '';
$gender = isset($_SESSION['gender']) ? $_SESSION['gender'] : '';
?>
<h1>
Tyler's Sessions Example
</h1>
<form method="post" action="">
<label for="name">Enter name: </label>
<input type="text" id="name" name="name" value="<?php echo $name; ?>"><br><br>
<label for="age">Enter age: </label>
<input type="number" id="age" name="age" value="<?php echo $age; ?>"><br><br>
<label for="gender">Gender: </label>
<input type="text" id="gender" name="gender" value="<?php echo $gender; ?>"><br><br>
<input type="submit" value="Submit">
</form>
<br>
<a href="week-9-my-example-two.php"><button>Next Page</button></a>
<br>
<?php
$name = $_POST["name"];
$age = $_POST["age"];
$gender = $_POST["gender"];
$_SESSION['name'] = $name;
$_SESSION['age'] = $age;
$_SESSION['gender'] = $gender;
echo $name . "<br>" . $age . "<br>" . $gender;
include("../includes/footer.php");
?>