Hi guys
I need some advice on how to best structure my forms and php code into
separate files, and how to move variables and form content between
them. I'm sure this is really standard stuff and it must have been
solved over and over already.
This is the flow of what's happening and how it's been structured so
far:
- Script1: Displays a varying number of products (from a previous
search) in a form, each with a check box. The user ticks the products
he wants to order, clicks continue and the form posts to Script2.
- Script2: Lists the products ticked in the form in script1, then
displays another form with input fields where user enters lots of
information. This script/form submits back to itself and performs
field validation until it's happy with all the input. When it is
(happy) the script goes off and does 'other stuff' (this is coded as
an include file) - and all works well.
Now I have decided to complicate things by showing another page just
displaying all information entered so far (in script1 and script2),
before going off to do 'other stuff' or go back to the form in Script2
to change the info. So I'd like to put all of this into Script3 and
call this from Script2, but this is where I run into problems. I
tried (in Script2) a header("Location: script3.php") - but that caused
header problems (although there are probably ways around this) - but
also this doesn't bring me across the form data?
I could code everything into Script2, but then that will be horribly
long and messy and difficult to read, so I'd rather not. This feels
like it must be standard stuff - any suggestions for a php-newbie on
how to solve?
thanks in advance
Milla