I've this problem getting the session variable on the next page.
on login, i have this code to set the variables.
<?
ob_start();
session_start();
session_unregister('login');
session_unregister('name');
session_unregister('id');
$pg = trim($_GET['pg']);
if (isset($_POST['p_em']))
{
$_SESSION['login'] = trim($_POST['p_em']);
$_SESSION['name'] = trim($_POST['p_fname']) . " " . trim($_POST['p_lname']);
$_SESSION['id'] = trim($_POST['p_id']);
}
if (isset($_GET['p_em']))
{
$_SESSION['login'] = trim($_GET['p_em']);
$_SESSION['name'] = trim($_GET['p_fname']) . " " . trim($_GET['p_lname']);
$_SESSION['id'] = trim($_GET['p_id']);
}
if ($_SESSION['login'] != "")
{
header("Location: loggedin.php");
}
else
{
header("Location: notlogin.htm");
}
?>
i am able to print out the session values at the end of this page. However, when the page gets redirected to the next page, loggindin.php, the session values are lost!
<?php
//loggindin.php
ob_start();
session_start();
print "<br>login:".$_SESSION['login'];
?>
the login page and the loggedin.php are opened in the same frame btw.
anybody have any idea why i cant get the session on the next page?