Jump to content

Advice on persisting DataObject


wincen

Recommended Posts

I'm writting my own php app using a front controller and MVC.  For something simple like site registration i have 1 registration model, view, and controller.  i want the registration to be done in 3 steps.  doing that is easy enough, but i'm wondering what is the best way to store the data the user enters in step 1 and carry it over to step 2?

 

currently the front controller creates a new registration controller on each time the user goes to the next step.  the registration controller creates a new model.  the old model's information is then lost.

 

how do experienced php developers deal with this?  do you store all user registration information in session variables to the end?  do you actually make database updates after each step?  is there another solution that i am compeltely missing? 

Link to comment
https://forums.phpfreaks.com/topic/76136-advice-on-persisting-dataobject/
Share on other sites

[currently the front controller creates a new registration controller on each time the user goes to the next step.  the registration controller creates a new model.  the old model's information is then lost.

 

The simplest method is to store each step in the $_SESSION array. Either that, or pass the data around in hidden forms.

The simplest method is to store each step in the $_SESSION array. Either that, or pass the data around in hidden forms.

 

so in each step i would have a session variable like $_SESSION['name'], $_SESSION['email'], etc etc?  it is straight forward, but it seems like it could get huge depending on what's required during registration.  when you say store each step in a $_SESSION array does that mean you can put the entire dataObject into a session variable?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.