Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- $ SESSION troubles


Pico_Train - 11:50 am on Dec 29, 2008 (gmt 0)


I am using $_SESSION to store a few details when a page loads. I refresh this page every 2 minutes and the $_SESSION variables get re-used without causing the whole to crash because on refresh you lose all the post data.

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!


Thread source:: http://www.webmasterworld.com/php/3815484.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com