RE: [PHP] VERY IMPORTANT: Sessions in Pages with a Form !

From: Date: Thu, 28 Sep 2000 03:22:11 +0000
Subject: RE: [PHP] VERY IMPORTANT: Sessions in Pages with a Form !
Groups: php.general 
Request: Send a blank email to php-general+get-17849@lists.php.net to get a copy of this message
Thank you all for your replies, guys. I found it useful by seeing how others were resolving this kind of problems. You see, I started using sessions like a mad, all the databases, web pages, trackers, _admin areas_, local intranet sites in my company are now having sessions in their config files. which are then going into databases, files, scripts, and so on... so we've got lot's of customized info on who did what and how often he does it. This is crucial for us to have it and there's no way to escape from any config file because of a form or other situation otherwise I would lose the sequence of a user's/maintainer's "adventure". The forms _are_ usually submitted to themselves, most of them are "post". But there are few things to do with them to save people's content when they get an error on a form. I can modify the forms of course, but, because I noticed that it's related to sessions only, I was looking for an answer that would help me to solve this problem completely. Guess it is not really possible right now to do. That's the way sessions are done, Sasha says. What about headers, cache control? I think it happens this way: when you get on a page for the first time your browser caches it, and if you reload the page (remember the page has sessions) the browser still keeps that cache from the first time - somehow it doesn't update it's previously cached version of the page. So when you submit something, reload the page, go to another page then hitting the back button what comes up is the page cached at the first time you downloaded it. I think it's pretty much what happening. I was testing it: I provocateur a parse error at line 25 on a new page, access it(seeing the error of course), then remove the error, submit a simple post form, hit back button: error line 25 is right here. Whatever then I would do with that page, on hit back -- parse error on line 25. (and this is not only my PC, I checked others, and asked others on this planet to tell me what they see) If you know/understand what I am talking about, please give me some idea on fixing, stabilizing this issue. Thank you all for your time. -----Original Message----- From: Simon Edwards [mailto:simon@animated.net.au] Sent: Thursday, September 28, 2000 8:14 AM To: Maxim Maletsky Cc: php-general@lists.php.net Subject: Re: [PHP] VERY IMPORTANT: Sessions in Pages with a Form ! Hi, > When I use sessions on a page that also has a form in it the back button > doesn't work. Like when a subscriber gets an error from my script saying > that he didn't fill the form out completely and he tries to hit back button > of his browser the whole form disappears. Every single field becomes empty. Does the browser reload the form when you hit the back button? > I know for sure that it is something that has to do with sessions, since > commenting them, back button will show you "your" form and not an empty one. I guessing that in this scenario you hit the back button and the browser *did* not reload the form from the server. I'm guessing, but it's probably a case of the browser reloading the form on 'back' when the sessions are used vs it just using a cached version when no sessions (and cookies) are in use. > It is very important for me to resolve this problem, since we saw a BIG drop > in subscriptions since I started using sessions in the pages using forms. > I know few ways to fix it, like: registering the sessions with the field > values, outputting the data again when there's an error, recording the data > submitted and prompting only for the missing one.. but, it's hard to explain > why, I REALLY NEED the back button to work with sessions just like it would > be without them, Don't use the back button. It fails in may situations. Just put your form and form responder code in the same page. If the use misses part of the form, don't use back, just output the form again and put the submitted form values into the new form HTML. -- Simon Edwards Animated Design, Melbourne http://www.animated.net.au/ Ph: (03) 98850990

« previous php.general (#17849) next »