[thelist] Forms and passing variables
Ken Schaefer
ken at adOpenStatic.com
Mon Jan 27 21:10:08 CST 2003
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Rachel Cunliffe" <r.cunliffe at auckland.ac.nz>
Subject: [thelist] Forms and passing variables
: I have a form with many fields in it, which processes it using php on
: another page. If there are required fields which are missing, it goes
: back to the previous page (using header location) with an error code
: appended to the file name, e.g. index.php?error=1. My problem is that
: the form does not remember what was entered in the first time (even
: though I am using echo $variable; in the text attribute.. Obviously
: because while the form variables were passed onto the second page, they
: have not been passed back to the first page.
:
: Is there a way of passing it back, without having to do
: index.php?error=1&variable1=foo&variable2=bar etc? A simple way of
: passing them back would be greatly appreciated.. Or do I really *have*
: to recode the way the form is processed and do it all on the same page?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I would do it the second way. Surely it can't be that hard...
- - - - - - -
If the form has been posted back
cut all your existing validation code
and paste it here. Insert code to
redirect to next page if validation passes
Otherwise
do what you were doing already
(ie setting up the form's initial state)
Display Form Here
- - - - - - -
Of course, if you wanted to keep your existing two page split, just about
all the existing state management systems would work: database, cookies,
data-in-URI
Cheers
Ken
More information about the thelist
mailing list