atomicrabbit Posted June 18, 2007 Share Posted June 18, 2007 ok, I've made a php email form with file upload and it all seems to work. The only problem is that for some reason, the back button doesn't work. Let me give you a bit of background first: The form has some javascript for client-side error tracking, then the php end of it does some more error checking (server-side). If an error occurs, like invalid file upload or invalid email or something else occurs, php will print a message out on the screen saying something happened and that the user should go back and try again. There is a link to javascript: history.go(-1) to go back to the form, or you can use the back button on the broswer. Now originally doing this left all of the users info in the form, which is what I want so the user can change anything that needs to be changed. But I've made a lot of changes to the php code, and now going back (by clicking the browser back button or the javascript link) displays the form, but everything is reset. I'm using a captcha on the page which a first I thought it was causing the form to be cleared when clicking the back button, but I tried removing the captcha and it still caused the problem. Does anyone know what would cause a form to get cleared when using to the back button to go back to the form?? Also, before, if I reloaded the page with the form, it would keep all the data on the form, but now, it clears everything. Link to comment https://forums.phpfreaks.com/topic/56093-php-back-button-on-form-not-working/ Share on other sites More sharing options...
atomicrabbit Posted June 18, 2007 Author Share Posted June 18, 2007 hellp Link to comment https://forums.phpfreaks.com/topic/56093-php-back-button-on-form-not-working/#findComment-277042 Share on other sites More sharing options...
kdreg Posted June 19, 2007 Share Posted June 19, 2007 I'm basically in the same situation and saw your post after I posted a question much later. I've been googling but all I got were 4 attempts to download trojans into my computer again, just like another time I searched for answers while hoping someone would answer here. So I'm a bit wary of that - Anyway, are you by any chance using a different and/or updated browser? I learned in my search that some browsers and versions handle the back button differently. I wondered if sessions or cookies might work, but my captcha has a session on the page that processes the form, so I think there was a conflict when I tried. I've been looking into using Javascript cookies, but I haven't been able to successfully implement that either. I'm even weaker at Javascript than I am at PHP. If I find a solution, I'll post back. If you do, I hope you will also. Link to comment https://forums.phpfreaks.com/topic/56093-php-back-button-on-form-not-working/#findComment-277431 Share on other sites More sharing options...
kdreg Posted June 20, 2007 Share Posted June 20, 2007 I realize my problem isn't exactly like yours, but did find this. I don't know if it will help. According to an old php tutorial, a solution is to enter header("Cache-control: private"); right below the session_start() of each script. Link to comment https://forums.phpfreaks.com/topic/56093-php-back-button-on-form-not-working/#findComment-278173 Share on other sites More sharing options...
atomicrabbit Posted April 3, 2008 Author Share Posted April 3, 2008 I know this is an old thread, but it still is not solved and I am now revisiting it. I tried the solution kdreg suggestion, but it does not work. Link to comment https://forums.phpfreaks.com/topic/56093-php-back-button-on-form-not-working/#findComment-508519 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.