'session variable is showing undefined index

I have created 2 php test page for check session variable, at first page php session is working but second page it is show undefined variable please check below

first page code is below:

<?php
 session_start();
$_SESSION['name'] = "sanjeev";
echo $_SESSION['name'];
?>

second page code is below

 <?php
 session_start();
echo $_SESSION['name'];
?>

it is showing below error, undefined index name

What setting i Need to check in php setting to check this issue

Thanks

php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source