Jump to content

How do you keep the text to stay in the text box


heldenbrau

Recommended Posts

The other possibility is repopulating the form based on the submitted data in $_POST.

Yes, normally but that wouldn't work if the back button is clicked as stated in the post. This forum uses ajax to save the data in a form so the page is not reloaded, that is why the data persists.

 

A cookie is a dumb idea! You don't store form data in cookies to maintain persistence. If I was logging into my online bank account would it be wise to store my account details in a cookie?

I think it's entirely the browser, and nothing to do with anything server side.

 

If you let your browser cache and save form field data, then it will do it... however, you can use sessions to force it to repopulate if you want.

 

But by hitting 'Back' you don't actually reload the page, so it really doesn't even matter what's changing server-side, as it's not being reloaded... which is why I suggested cookies, which are stored client-side. Obviously you just have to be picky about which forms you want to save.

I think it's entirely the browser, and nothing to do with anything server side.

 

If you let your browser cache and save form field data, then it will do it... however, you can use sessions to force it to repopulate if you want.

 

But by hitting 'Back' you don't actually reload the page, so it really doesn't even matter what's changing server-side, as it's not being reloaded... which is why I suggested cookies, which are stored client-side. Obviously you just have to be picky about which forms you want to save.

 

Best practice would be to use sessions, there are times when sensitive form data should not be kept client-side but rather server-side (cookie grabbers, etc...)

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.