0

hi n working with a code but m facing a problem of undefined index. i have seen it occurs due to unavailablity of data or like that but here i m declaring that data jst before its use. rest of variable are working correctly just SESS_dept is giving error plz can you] tel why?

$employee = mysql_fetch_assoc($result);
      $_SESSION['SESS_EMP_ID'] = $employee['employee_id'];
      $_SESSION['SESS_NAME'] = $employee['employee_name'];
	  $_SESSION['SESS__dept']=$employee['department_name'];
	  $_SESSION['SESS_rank']=$employee['rank'];
      
      session_write_close();
	  if 
	  ($_SESSION['SESS_rank']=="admin")
	  {
      header("location: administrator.php");
      exit();
	  }
	  
	  elseif ($_SESSION['SESS_dept']=="molding")
     	 {
			if($_SESSION['SESS_rank']=="shift incharge")
	  		{
	  		header ("location: Shift_incharge.php");
	  
	 	 	exit();
	  		}
2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by charlybones
0

You have a syntax error in your code. First you declare this:

$_SESSION['SESS__dept']=$employee['department_name'];//error here, remove one underscore from the SESS__dept

But then you use this:

elseif ($_SESSION['SESS_dept']=="molding")

Your SESS_dept has two underscores ('_ _') when you initialize it.

Just remove one underscore from the first one.

Edited by charlybones: n/a

0

thnx its solved. but now my page is not redirecting to any where it jst show blank page

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.