Session Variables losing value between pages in php
-
hi there,
I am trying to call a session variable declared in Program-1. Everthing works fine in Program-1, but everytime whenever I try to call the session variable from Program-2, it returns nothing. Why is it so, below is my code. Pls help
Program-1<?php session_start(); ?> <?php include ("dbcon.php"); include("BrowserDetection.php"); include("included_functions.php"); if (trim($_SESSION['login_mail'])=="") { $_SESSION['login_mail'] = "Guest"; } $umailid = trim($_SESSION['login_mail']); if ($umailid == "Guest"){ $fullname = "Guest User"; } else { $pickname = "select u_name from user_dtls where u_emailid = '{$umailid}'"; $result = mysqli_query($connection, $pickname); $resultarr = mysqli_fetch_array($result); if (!$resultarr) { die("Database Query failed." . mysqli_error($connection)); } else {$fullname = $resultarr[0];} } ?> <!DOCTYPE html> <html> <head></head> <body></body> </html>Program-2
<?php session_start(); include ("dbcon.php"); if ($_SESSION['ulogin'] != "Guest"){ //*Code } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Session Variables losing value between pages in php’ is closed to new replies.