Page 1 of 1

Going back to edit a form

Posted: Tue Aug 12, 2003 1:18 pm
by acs888
i have created a form using php. when the user submits the form (for the first time) the form is 'parsed' and then displayed in a non-form page. the user has the chance to edit any errors or just send as-is. if the user has an error i tried using:

<input type="button" value="Edit" onclick=
"history.go(-1)">

this obviously takes the user back to the initial form page, however the form is reset. how do i 'save' or reload the form for the user to edit? thanks!

Posted: Tue Aug 12, 2003 1:29 pm
by JAM

Code: Select all

<?php
    header("Cache-control: private");        
?>
On top of the page(s) might do the trick, but I'm getting nervous because another user here said that 'it depends' if it's this issue...

Other thoughts might be to;
Add the form's information in hidden-<input>'s aswell as in the non-form part of page.
Add another submitbutton with topic "Change" that resends the info from the hidden fields.
Once that is done, you have new info you can put back into the value="" areas in your form...

Geez, sounded messy...

Posted: Tue Aug 12, 2003 1:29 pm
by Seth_[php.pl]
Use sessions to store variables posted from form.

When you print form site check if there are session variables.
If exists some datas print them in value property of form item.
Instead of history.go(-1) use link to form.

That should solve problem.

Posted: Tue Aug 12, 2003 1:43 pm
by acs888
thanks man,
<?php
header("Cache-control: private");
?>

did the trick!!