Forum Moderators: coopster

Message Too Old, No Replies

prolem in retriving session values

checking the existance of session variable

         

kadnan

11:34 am on Mar 10, 2004 (gmt 0)

10+ Year Member



i am implementing session based shopping cart,how ever i am having problems in checking the existance of session varable

what i am having problem that when user click ADD TO CART first time,it mesgs that session doesn`t exist
i am using add2cart.php file for adding the item in session array and then redirecting it to basket.php for displaying Basket Item

i am checking existance of session array something like that
if(!(isset($_SESSION['arrPid']))
{
print("session expired");
exit;
}
on add2cart.php,i am using ob_Start() in the beginning and ob_end_flush() in the end of file but its also not helping me out

Clicking second time it shows the value in basket
please help me out,i am finding no clue to solve the problem

Thanks
-adann

stargeek

12:58 pm on Mar 10, 2004 (gmt 0)

10+ Year Member



are you staring the session, before outputting anything to the browser, on every page? Something like this:
ob_start();
session_start();
if(!(isset($_SESSION['arrPid']))
{
print("session expired");
exit;
}

theriddla1019

2:12 pm on Mar 10, 2004 (gmt 0)

10+ Year Member



yeah make sure you have started your sessions on all pages that include session variables. ive made this mistake a few times :P