×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Problem with session dropping/loosing value

Problem with session dropping/loosing value

Problem with session dropping/loosing value

(OP)
NOTE: PHP based application that uses AJAX to process and render data.

I use $_SESSION to track where a user current course of action is or last action was. The idea is to store content so that if they F5 the page I would retain the information they last submitted and keep pages content in solid state.

Content would change only if (a) user changes it and/or (b) form is submitted and new tabulated results are obtained.

I am stuck using a non *SQL environment using a legacy application so storing session to *SQL is not really an option.

Most confusing is that the $_SESSION holds values such as user credential hash keys that are set upon login in. What I am loosing or not retaining is the "additional" elements

CODE

$_SESSION['rates']['request']=$_POST;
$_SESSION['rates']['response']=$ResPonse; 
The first is obviously the content of the form as last submitted and ResPonse is the content obtained after form data is processed.

if I do a var_dump just after and/or before, I can see the content as I would expect. When a new page is called and the session is referenced, content is gone! In fact, even without moving from one page to the next, a simple AJAX call to a php script that simply do var_dump($_SESSION); comes back with above session elements gone or not set.

Why or what would cause these to just vanish? No changes to server at all ... since it last worked!!!


--
SouthBeach
http://www.fp2php.com
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.

RE: Problem with session dropping/loosing value

(OP)
Solved!

I found

CODE

$_SESSION['abc']='abc'; session_write_close(); 

then further down

CODE

$_SESSION['rates']['request']=$_POST;
$_SESSION['rates']['response']=$ResPonse; 
session_write_close(); 

It appears that session_write_close() is best used ONCE within the script not as $_SESSION is being set!

--
SouthBeach
http://www.fp2php.com
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close