Different Includes Depending on Session

Hello,

I’m trying to make different files included depending on the session variable (taken from row in MYSQL).

Right now I have it working with two variables (session equals 1 and session does not equal 1).

Here is my code

[code]<?php
session_start();
$_SESSION[‘session’]=$session;

if ( $_SESSION[‘session’] == 1 ) {
include ‘1.php’;
}

else {
echo “not found”;
}
session_destroy();
?> [/code]

I’m trying to make it so that I can have 3 session variables (1,2,3) and a different file is included depending on the session (1.php, 2.php, or 3.php).

I’m thinking the code would like something like this

[code]<?php
session_start();
$_SESSION[‘session’]=$session;

if ( $_SESSION[‘session’] == 1 ) {
include ‘1.php’;
}

if ( $_SESSION[‘session’] == 2 ) {
include ‘2.php’;
}

if ( $_SESSION[‘session’] == 3 ) {
include ‘3.php’;
}

else {
echo “not found”;
}
session_destroy();
?>[/code]

But it ain’t working for me.

Any help is always greatly appreciated.

Thanks,
Robert

Are you getting any errors (see also the debugging thread linked to in my signature)?

Sponsor our Newsletter | Privacy Policy | Terms of Service