Hi All,

How you can help me with something.

when a user logs in and is successful, i want the value of the user "type" to be stored in a session, which is then passed to the "login successful" page where i intend to use a switch statement to determine where they are to be forwarded to.

I know im almost there, but cant see my problem

This is the "checklogin.php" code, and the code after is the "login successful

$sql="SELECT user_type, user_email, user_password FROM tbl_user WHERE user_email='$user_email' and user_password='$user_password'";

// Mysql_num_row is counting table row
$user_type = $result['user_type'];
// If result matched $email and $mypassword, table row must be 1 row

// Register $email, $mypassword and redirect to file "login_success.php"

else {
	echo"there was a problem";

//header( "location:index.php");



// Check if session is not registered , redirect back to main page.
// Put this code in first line of web page.
if(!session_is_registered(user_email)) {
} else {
	echo "This worked";
	echo "you are a ";
	echo $_SESSION[$user_type];

from looking at this i know its passing through the session content of "user_email" so something is working

From a quick glance, it may be that you are missing session_start(); from checklogin.php.

Whiteyoh, try starting the session.

session_start is required in all of the PHP scripts that are supposed to work with user data. So


should go into all of the scripts and it has to be at a position where HTTP header data can still be sent. So it should come early in your code. Next part: AFAIK session_register is deprecated in the meantime. So I would put:

$_SESSION['utype'] = 'A';  // for user type A - take a numeric scheme if you like

and then do the processing based on that SESSION Variable:

if (isset($_SESSION['utype']) && $_SESSION['utype'] == 'A') {
   header('Location: loggedin.php')
} else {
   header('Location: tryagain.php')

something along those lines