Forum Moderators: coopster
Now if the user wants to go back and add something, and then continue on to the page where the $_SESSION gets created and stored, the $_SESSION stays the same as the old one and the new addition is nowhere to be found.
Is there a way I can re-create or update a session?
My first check does -
if(!empty($_POST) && !isset($_SESSION))
{
set a whole bunch of $_SESSION vars with session_register('varname');
}else{
session_start();
$_SESSION['var'] = $_SESSION['var'];
}
even if close the browser, say an old session had 3 items and I go and do one with 1 item, when I print_r($_SESSION); it will have 3 instead of 1...
Getting a bit frustrated here and would really appreciate any help anyone can provide. Thanks!
Use of $_SESSION is preferred, as of PHP 4.1.0
If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled.
As of PHP 4.2.0, the default value for the PHP directive register_globals is off . . . The PHP community discourages developers from relying on this directive, and encourages the use of other means, such as the superglobals.