Hi folks, I'm having some problems setting session variables from within a class i've created. $SESSION can be modified from outside the class, but putting a $SESSION['test'] = 1; inside the class constructor doesn't do anything when the object is created. I'm calling session_start() before I include the class file, so I don't think that's the problem.
Example:
<?php
session_start();
$_SESSION['test'] = 1; // this works
include("class.php");
$my = new Class();
$my->setSession("sesstest", 1); // this doesn't work
?>
The setSession() function just executes $_SESSION[$arg1] = $arg2;
Going to a 2nd test page that reads and prints out the session values shows that $_SESSION['sesstest'] does not exist, even though it should. Can someone explain why this is happening? I'm trying to use sessions to store shopping cart information, but my cart class can't do anything with them!
Thanks much.