...

View Full Version : How do I create a multi-page order form.



ghost2012
05-11-2009, 09:51 PM
What I am trying to learn is how to create a multi-page order form. Where whatever is selected from the first page is passed to the next page for confirmation before it is processed by php for email. I know how to create forms and enough php for the only the 1st page to be processed. If you need more of a description just let me know. This is still a learning phase for me.

timgolding
05-11-2009, 10:01 PM
It works the same as a two page process except you have to pass the previous data on to the next. Either with hidden (http://www.w3schools.com/htmldom/dom_obj_hidden.asp) form elements or sessions (http://uk.php.net/manual/en/ref.session.php).

hidden form approach:


//Somewhere in the form for second page
foreach($_POST as $key => $value)
echo '<input type="hidden" name="'.$key.'" value="'.$value.'" />
';


Session approach:


<?php
// At top of script
session_start();

foreach($_POST as $key => $value)
$_SESSION[$key]=$value;



I think the session method is best.

Len Whistler
05-11-2009, 10:04 PM
I would also consider using COOKIES so that if the user fills out half of the form he can come back some other day and not re-enter that data.



--------------

timgolding
05-11-2009, 10:12 PM
I would also consider using COOKIES so that if the user fills out half of the form he can come back some other day and not re-enter that data.



--------------

Tis a good idea :thumbsup:

bazz
05-12-2009, 01:46 AM
yeh, sessions are a good way to do it.

I have shied away from cookies for my apps because some poeple have js switched off and so consistency is lost but, also, if they want to start something, they should finish it. the rewards are good because if they come back a few days later and have a cookie to 'pick up where they left off', whatever they are filling in for, may be gone/sold/booked.

you need to work out your product/site and know your customers needs, to be sure which way to go.

bazz



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum