views:

49

answers:

5

I am trying to develop a registration page which involves three seperate information.

First Page will get contact details Second page - working details third page - study details.

How to keep the form data of the previous pages before posting the form?. Plz help any help will be appreciated

+4  A: 

You could do it with Ajax - multiple divs and hide/show the appropriate ones. Or you could POST each page and save the data in the $_SESSION global variable until all pages are complete. Then save it all to the database.

David Radcliffe
+1 For completeness, I'll mention the old school way of including the previous pages' data in the next page's form.
webbiedave
A: 

Back in the day, I would've put hidden fields for all of the previous pages in each subsequent page, so the final submit would have everything... i.e.

Now, I would probably only have one actual page.. with multiple steps implemented by showing/hiding div's and collecting all of the data in one big form, broken up visually for the user... and if I was feeling especially frisky, with frequent validation and final submission through ajax.

Fosco
In other words, "see previous answer." ;)
webbiedave
I elaborated quite a bit more... I've quickly found that one liners that make absolute sense to me are still greek to people asking questions.
Fosco
+1  A: 

You should take a look at http://jqueryui.com/demos/tabs/, it should be able to do what you need.

sgrif
A: 

While shifting to another page, you just put the values of first page variable in sessions, then you can access the value of previous page at any page, then post the value to the database query. In this way, you can use the use the value of first page at third page, up to when browser is open. As the browser close then variable lost their values.

All the Best !!!

Rahul Patil
A: 

While the other answers are certainly good ideas, you may also want to consider persisting the intermediate data to your database between each page. So, submitting the first page would create the new row, with the columns relating to contact details populated, and a status column set to a value indicating that the submission is not yet complete.

The second page would update that record in the database. The third page would also update the record, as well as the status flag to indicate the submission is complete.

The main benefit to this is that the user can walk away after the first (or second) page, and then return to it later, even if he had closed his browser and his session had expired. (As long as he has a unique URL to return).

This approach might not have a lot of benefit if you are only collecting three pages of data, but if you had many pages, the ability to leave and return later might be more important.

pkaeding