tags:

views:

912

answers:

3

Hi ,

When I click back on any browser I lose all the data which was inputted in the form on both drops downs and text input types.

Is this a server , Browser or a coding issue ?

Thanks

+1  A: 

You need to create sticky forms for the browser to keep form data when back is pressed. Its fairly easy to do, check out the tutorials in the search linked.

Christian
+6  A: 

Its a browser issue. Browser behave differently when the back button is clicked -- this behavior mostly depends on user privacy settings. In addition, most browsers will automatically reset form upon hitting back button for pages viewed over HTTPS connection regardless of their normal behavior for HTTP connections. In addition, many HTML forms that rely heavily on AJAX do not properly -- or consistently -- restore their previous state.

Edit ----

Now that you mention using PHP and MySQL, assuming that you are also using sessions... the browser will not pre-populate the form when you hit the back button. PHP-session powered pages are not cached in browsers and hitting back button to go back to previous page is just like opening that page again from the very beginning -- most browsers will not bother restoring the form values.

Salman A
I found that Safari does keep the data but IE and FF do not.
Oliver Bayes-Shelton
Were are using sessions correct, So there is no way around this issue really until the browser stops allowing the user to click back.
Oliver Bayes-Shelton
Is it possible to use the sessions to our advantage ?
Oliver Bayes-Shelton
Try looking at the possible values for session_cache_limiter at: http://us2.php.net/manual/en/function.session-cache-limiter.php and try using a less aggressive setting for your app. If I were you, I'd use recursive pages and restore form data via code.
Salman A
I'd say... a setting of private_no_expire would be OK
Salman A
A: 

SAFARI DOES THE TRICK!!!! Hooray! I have been searching for an "easy fix" for a LONG time. Thanks for the tip.

Nikki T