What are you wondering?
First of all, you don't start the session before adding username and password (why on earth are you adding the password to the session after all?). You need to uses session_start in any script that is accessing session state, before accessing session state (of course take account of the
includes).
Secondly, if you want to look at an array element, and you don't suppress this level of error (see:
http://php.net/manual/en/function.error-reporting.php[
^]), you have to check the existence of the key to avoid such messages, and by the way you have to swap if and else branches to give them sense:
<?php
session_start();
if(isset($_SESSION['userName']) && !empty($_SESSION['userName']))
{
echo '<h2>Successfully Login <br /> </h2>';
echo "hello=". $_SESSION['userName'];
echo '<a href="logout.php"> Log Out</a>';
}
else
{
header("location:login_form.php");
}
?>