tags:

views:

49

answers:

2

I have web-site and I need to create that step-by-step adds:

  1. Selecting Country, city, etc
  2. more information about project
  3. Photos
  4. Message/etc

How is correct to do these steps? Get paraemtrs like step/1/ and get info from DB on every step, use $_SESSION(Save step num, info from prev.) or.. ? in each step i need to get information from previous step, in code i have this structure:

class Manager {
__construct() { ...method call}
private function addNewObject() {}
private function addNewStep2() {}
private function addNewStep3() {}
private function addNewStep4() {}
}

thanks

+1  A: 

I would use JavaScript for this by creating a group of divs that are hidden or displayed as each step is completed. This way you can easily access previous form elements and allow the user to go back to a previous step without picking up problems with data that is already 'saved'. The data is then saved to DB (or wherever you won it) when he completes the final step. You can always use AJAX if you need to communicate with the server to get or process data between steps.

Meloth
A: 

You could also save the data from each step into the session like $_SESSION['step_1_data'] and $_SESSION['step_2_data']. Then the last step can pull that data back out and save to the db or whatever you need to do.

David Radcliffe