Multiple page submission form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Appleton
Forum Newbie
Posts: 3
Joined: Fri Jul 06, 2007 4:52 am

Multiple page submission form

Post 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.
Last edited by Appleton on Fri Jul 06, 2007 5:04 am, edited 1 time in total.
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

What about session?
Appleton
Forum Newbie
Posts: 3
Joined: Fri Jul 06, 2007 4:52 am

Post 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?..
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Post 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.
Post Reply