losing form data
Moderator: General Moderators
losing form data
i am validating form data, but when i redirect the user back to the form page to correct their errors, all the data they entered has disappeared.
Please Help.
Thanks
Please Help.
Thanks
- Derfel Cadarn
- Forum Contributor
- Posts: 193
- Joined: Thu Jul 17, 2003 12:02 pm
- Location: Berlin, Germany
You'll need something like:
Code: Select all
<input type="text" name="name" size="50" id="Name" value="<?php echo $HTTP_POST_VARSї'name']; ?>" />You need to add a header() before anything is printed to the browser.
A bug in IE6.
Code: Select all
header("Cache-control: private");- Derfel Cadarn
- Forum Contributor
- Posts: 193
- Joined: Thu Jul 17, 2003 12:02 pm
- Location: Berlin, Germany
unfortunately this didn't seem to fix the problem.
in fact, i am able to recreate it using Netscape as well...(?)
is this some kind of default php characteristic with dynamically generated (HTML) forms?
i guess it is rewriting the page each time the user clicks away.
is there any way to prevent this?
Thanks
in fact, i am able to recreate it using Netscape as well...(?)
is this some kind of default php characteristic with dynamically generated (HTML) forms?
i guess it is rewriting the page each time the user clicks away.
is there any way to prevent this?
Thanks
-
Cruzado_Mainfrm
- Forum Contributor
- Posts: 346
- Joined: Sun Jun 15, 2003 11:22 pm
- Location: Miami, FL
You're supposed to lose form data if you actively navigate away from it without submitting. HTTP is stateless... that's just how it works.
So any time you've navigated away from a form and come back and your data has remained, that's either a browser FormFill sort of setting, back history memory, or a site that's using sessions/cookies to store your data.
So any time you've navigated away from a form and come back and your data has remained, that's either a browser FormFill sort of setting, back history memory, or a site that's using sessions/cookies to store your data.
Very true, my header()-example only works if the form was POST was sendt. I have tested this in many forms, and yet havn't found any problems about missing information that didn't belong to this bug.Unipus wrote:You're supposed to lose form data if you actively navigate away from it without submitting. HTTP is stateless... that's just how it works.
A javascript guru might be able to do this, but a personal oppinion is why put down the effort? PHP will never solve this as the information is trapped in the client (javascript might work).i should be more specific.. the problem also occurs if the user clicks away (say, the back button), and then clicks back to the form -- all data is gone in that case, also.
is there a way to prevent form data from disappearing, whether or not it has been submitted into post variables?