the182guy
Jun 24th, 2007, 05:31 AM
I'm storing a shopping cart object in a session, it works fine when navigating pages in the application, the object is being retained intact, however if I close the browser and go back to a page it doesn't retain. Either the items member of the object is being cleared, or the session is being destroyed. I've used sessions before storing simple strings for a login system, it allowed me to close the browser and return to the page still logged in, thats what I'm trying to achieve.
Here's how I'm storing the object in the session:
<?
require_once("clsCart.php");
session_start();
if(!isset($_SESSION['cart']))
{
//cart doesn't exist
$_SESSION['cart'] = new cart;
}
Edit: Sometimes it is working, when I close and open it back up but sometimes not. I'm not leaving any length of time between closing and opening.
Cheers all
Here's how I'm storing the object in the session:
<?
require_once("clsCart.php");
session_start();
if(!isset($_SESSION['cart']))
{
//cart doesn't exist
$_SESSION['cart'] = new cart;
}
Edit: Sometimes it is working, when I close and open it back up but sometimes not. I'm not leaving any length of time between closing and opening.
Cheers all