Jump to content

php back button on form not working ??


atomicrabbit

Recommended Posts

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

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.

 

 

 

 

  • 9 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.