<?php
//PAGE 1
// Start the session
session_start(); //<- IMPORTANT TO SET IT AT THE TOP IN PAGE 1
?>
<!DOCTYPE html>
<html>
<body>
<?php
// Set session variables
$_SESSION["favcolor"] ="green";
$_SESSION["favanimal"] ="cat";
echo "Session variables are set.";
?>
---------------------------------------------------------------
<?Php
//Page2:
session_start(); //<- IMPORTANT TO SET IT AT THE TOP IN PAGE 2
echo "my favcolor is".$_SESSIO["favcolor"];/*here it will display my fav color is green*/
?>