cstr001 Posted July 24, 2008 Share Posted July 24, 2008 Hey guys, I have quite a serious problem with my session variables on my website. To give you the run down, I have four pages. The first is user selection in a form which via post method is passed into the normal; $_SESSION['example'] = stripslashes(strip_tags($_POST['example'])); on the next page the form links to. The following page has user details which again, put into a form and posted to the next page whereby the data is put into more session variables. I have run echo's at this stage to make sure the data is being kept.. This is done again on the third page ( I hope I haven't lost you here ). Until, the last page is reached where there is NO code advising the session to be destroyed or anything.. all the session data apart except from the page before it, is lost. OK so I thought there might be some funky code on the 3rd page that might be doing something odd, I checked this by calling one of the variables previous at the very end of the page OUTSIDE of the HTML code. And the variable is returned. The second that 3rd page goes into the last, the data goes. So I wrote a bland last page just with a simple; if (isset($_SESSION['example'])) to see if the variable is still there... negative. I'm completely stuck and I've never had session data just disappear on me before so I need any help I can get. Am I going to have to end up using SQL to store the form data? Or can I just purely do it with sessions? Cheers Link to comment https://forums.phpfreaks.com/topic/116376-session-issues/ Share on other sites More sharing options...
MasterACE14 Posted July 24, 2008 Share Posted July 24, 2008 you haven't missed out the session_start(); at the top of the last page have you? Link to comment https://forums.phpfreaks.com/topic/116376-session-issues/#findComment-598404 Share on other sites More sharing options...
cstr001 Posted July 24, 2008 Author Share Posted July 24, 2008 lol nope, session is started and I echo the session_id to make sure it's being kept Link to comment https://forums.phpfreaks.com/topic/116376-session-issues/#findComment-598442 Share on other sites More sharing options...
JonnyThunder Posted July 24, 2008 Share Posted July 24, 2008 You know what - a couple of years back I wrote a huge web engine which included PHP session control. About half way through writing it, strange stuff like that started to happen - session data just disappearing for no good reason. I ended up writing my own session control class, and using mySQL to store the data. After that, I had no more issues. I've always said there is something wrong with PHP sessions. Anyway, good luck with that! Link to comment https://forums.phpfreaks.com/topic/116376-session-issues/#findComment-598444 Share on other sites More sharing options...
MasterACE14 Posted July 24, 2008 Share Posted July 24, 2008 show the code for the last page. Relevant code only. Link to comment https://forums.phpfreaks.com/topic/116376-session-issues/#findComment-598445 Share on other sites More sharing options...
revraz Posted July 24, 2008 Share Posted July 24, 2008 Actually, post all of the last page and also post how you call that page. Link to comment https://forums.phpfreaks.com/topic/116376-session-issues/#findComment-598584 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.