I’ve a form I wrote that, when page 1 is submitted to page 2 (which validates info and displays what the user input before it’s all inserted into the DB on a POST to page 3), all the POST values are turned into SESSION values.
That way, ideally, if the user goes back in their browser to page one to change something, the form fields will be populated with the SESSION values.
The browser cache is untrustworthy and, especially in IE, when they go back to page 1, the form is empty (which is what necessitated my creating SESSION values in the first place). And this works fine.
But here’s the problem:
I created an edit process, that when a previously submitted entry is selected, all the form fields populate with the DB saved values. And, from there the form process works as normal.
BUT! If during this edit they go from page 2 back to page 1, the form fields will always show the data it was originally populated with and NOT the SESSION values.
I know the SESSION values are working because, well, when the form is being filled it from blank, going back will populate the fields with the SESSION. And a print_r of SESSION on page 1 shows all the proper values.
(Just to illustrate, here’s a bit of script from page 1)
[code=php]
if (isset($_SESSION[‘txt_loc_code_1’])) {
$txt_loc_code_1_value = $_SESSION[‘txt_loc_code_1’];
}
[… snip …]
<input name=”txt_loc_code_1″ type=”text” id=”txt_loc_code_1″ value=”‘.$txt_loc_code_1_value.'” />
Any ideas what I can do to make sure page 1 always displays the value I define in PHP rather than whatever the browser wants to put in there?
Thanks!