Page 1 of 1

Multiple page submission form

Posted: Fri Jul 06, 2007 5:00 am
by Appleton
Hiya,

Okey - im currently in the process of developing an insurance quotation system, I have a form which needs to be completed which is 40/50 questions long. I want to break this down into pages.

Ive create each section of the form as an include file
inc_page1
inc_page2
inc_page3 etc

I have then create an index page which includes them based on id number from URL (index.php?id=1) This will lead to a final page id=6 which will perform the calculation, initiate an email and insert data into the backend SQL database.

I have everything else working - but im struggling with a tidy solution to moving the form submission data from one form to the next?
page 1 -> page 2 -> page 3 -> page 4 -> page 5 -> finally page 6

Im currently posting form fields from one to the next, and hidding these fields on the next page.

Could anyone suggest a cleaner solution?

Thanks

Rob.

Posted: Fri Jul 06, 2007 5:04 am
by Gente
What about session?

Posted: Fri Jul 06, 2007 5:09 am
by Appleton
Hiya,

From sessions i assume you mean Cookies? - Ideally due to the sensativity of the information, I would prefer not to store the data in the form of cookies on their local PC. This would also stop corporate users who block cookies from using our service?..

Posted: Fri Jul 06, 2007 5:27 am
by volka
Appleton wrote:From sessions i assume you mean Cookies?
I guess, Gente would have written "What about cookies?" then.

see http://de2.php.net/session

Posted: Fri Jul 06, 2007 8:58 am
by aceconcepts
I've currently been working on a registration system made up of multiple pages.

Firstyl I setup up 4 session variables ($_SESSION["stage1"], $_SESSION["stage2"]...) as my registration is only 4 pages long.

I set the intial values to all these session variables to zero.

I use forms to submit data from each page. I direct the form action"..." to the same page and then validate the user input (email etc...).

If validation is ok then I set the session value of that page to 1 ($_SESSION["stage1"]=1;).

To get to the next page of registration I then use a conditional statement e.g.:

Code: Select all

if($_SESSION["stage1"]==1 && $_SESSION["stage2"]==0)
{
   include"stage2.php";
}
I do the same thing for the subsequent pages. This works perfectly for me.

As for the data, I just store that in encoded session vars.