Jump to content

[SOLVED] Make forms retain content


Catfish

Recommended Posts

Hi ppl,

 

When you put data into a form element and then submit the form, if you press the back button the form will have been reset to its default state.

 

Is there a way to preserve the content that the user put into the form after it is submitted and the back button is pressed?

Link to comment
Share on other sites

I don't actually want to store the data in a variable, I just want it to remain in the menus when the user presses the back button in the browser.

 

I noticed that this feature happens in certain forms online and not others, and I also think it could depend on the browser software but I don't have any solid evidence that this is what controls it. Since I don't know what controls the preservation of the form data I was putting out here to see if anyone knew about it.

 

It would be handy for me in my scripts if I could control such a feature, then the user could decide if they wanted to preserve form data as they perform data input - because common data elements could be kept in the form elements between each record submission thereby reducing the amount of typing required for a record to be input.

Link to comment
Share on other sites

This is the best solution I've found:

 

http://answers.yahoo.com/question/index?qid=20080116063609AAh9Q2B

Which links to:

http://www.dynamicdrive.com/dynamicindex16/formremember2.htm

 

A javascript that will retain form values for you globally over your webpages. This was better than his original script because there is no modification of the form HTML code required. (Better for me anyway) And it has a toggle option to turn it on or off which I will want in the future too.

 

It seems that in PHP you have to manually store values you want using $_SESSION and write your scripts in a particular fashion to use the $_SESSION values and reinsert them into a form etc. In any case, this topic is as good as solved for my likings!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.