i am setting session for a user
when a user login it redirect to staff.php file in the start of staff.php there msg should display welcomes to the staff area and my user namee
i mean if i login with name azeem then it shud say welcome to staff area ,azeem
problem is this when i hit login button it takes me to staff.php area with this warning or error msg kindly help methis is the msg i got
Staff Menu
Welcome to staff Area.,
Notice: Undefined index: username in C:\wamp\www\az\staff.php on line 14
this is my few lines of code where i set my session
code is
if ( empty($errors) ) {
$query = "SELECT id,username ";
$query .= "FROM users ";
$query .= "WHERE username = '{$usrname}' ";
$query .= "AND hashed_password ='{$hashed_password}' ";
$query .= "LIMIT 1";
$result_set=mysql_query($query);
confirm_query($result_set);
if(mysql_num_rows($result_set)==1){
$found_user=mysql_fetch_array($result_set);
$_SESSION['user_id']= $found_user['id'];
$_SESSION['username'] =$found_user['username'];
redirect("staff.php");
} else {
$message="username/Password combination incorrect.<br/>
check may be caplocks is on and try again.";
}
and in staff.php i m calling it this session is like this
<td width="891" align="left" bgcolor="#FFFFFF" id="pages">
<h2>Staff Menu</h2>
<p>
Welcome to staff Area.,<?php echo $_SESSION['username'];?></p>