i have a two menu bar option which are home and my account
after login my user and pswd its show home page but when i change home to my account page its show message below and logout
Notice: Undefined index: user in folder\myaccount.php
Notice: Undefined index: pswd in folder\myaccount.php
you are not logged in

these both fields are my login page variables user and pswd

post your code

this is my code of login if i refresh my page its logout or menu bar also show logout

<?php
$userid = ($_POST['userid']);
$pswd = ($_POST['pswd']);
$conn = oci_connect('user', 'pswrd', 'db');

$query = "SELECT userid, pswd FROM staff
WHERE userid=:userid AND pswd=:pswd";

$stmt = oci_parse($conn, $query);
oci_bind_by_name($stmt, ':userid', $userid, 8);
oci_bind_by_name($stmt, ':pswd', $pswd, 32);
oci_execute($stmt);
list($userid, $pswd) = oci_fetch_array($stmt, OCI_NUM);
if ($userid != "" && $pswd !="")
{
$_SESSION['userid'] = $userid;
echo " logged in sucessfully!!!...";
}
else {
    echo"you are not logged in ";
    }

?>

Try this

<?php 

    session_start();

    $userid = ($_POST['userid']);
    $pswd = ($_POST['pswd']);
    $conn = oci_connect('user', 'pswrd', 'db');

    $query = "SELECT userid, pswd FROM staff
    WHERE userid=:userid AND pswd=:pswd";

    $stmt = oci_parse($conn, $query);
    oci_bind_by_name($stmt, ':userid', $userid, 8);
    oci_bind_by_name($stmt, ':pswd', $pswd, 32);
    oci_execute($stmt);
    list($userid, $pswd) = oci_fetch_array($stmt, OCI_NUM);
    if ($userid != "" && $pswd !="")
    {
    $_SESSION['userid'] = $userid;
    echo " logged in sucessfully!!!...";
    print_r($_SESSION);
    }
    else {
        echo"you are not logged in ";
        }

?>

still problem is same when i enter in url to refresh this error is show

Notice: Undefined index: userid in ...\login.php on line 3

Notice: Undefined index: pswd in ....\login.php on line 4
you are not logged in

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.