[thelist] sequential forms (PHP)

John Corry webshot at members.evolt.org
Thu Apr 18 16:21:01 CDT 2002


I have a site that has an ordering process that requires 2 forms.

form 1 : display the item details and get the information for where the item
is being shipped to
form 2 : get the information for who the customer is and how they're paying
confirmation page : display everything they submitted and ask them to
confirm or edit they're choices

So, how do I store all those variables through 3 pages?

1) I use a 'temp' table in my db and link a visitor to their data via a
session variable. Takes some time to set this up, but it's probably pretty
robust

2) I use 'hidden' form fields to hold the values from the previous page and
to hold ALL of the values on the final page. (Or, when I ask them to confirm
the order, I just display all of their choices in form fields so they can
edit them right there on the confirmation page...that saves some work)

3) Something else I'm not thinking of. I know when I submit a form, I have
all of the variables of it's elements in the array $_POST, can I just pass
the array to the next form in one hidden field?
<input type="hidden" name="form 1 values array" value="$_POST"> <= Seems
like on form 2, this hidden field would contain all of form 1's $key, $value
pairs, which I could then submit along with form 2's info to the
confirmation page, at which point I can stop for the day and go to the
beach.

What do you think?
John Corry




More information about the thelist mailing list