laravel - How would you make a wizard system with PHP? -


i need create wizard system 1 of projects , how handle right now.

/*    pseudo functions */  function wizard_start() {     //fill table default values, set isvisible column 0 }  function wizard_step_1() {     //update necessary columns (e.g name, sirname) }  function wizard_step_2() {     //update necessary columns (e.g date, type) }  ...  function wizard_final() {     //do last touches , update isvisible 1 appear on website } 

i keep our current step in session. like;

isset($_session['step2_completed'])     $this->wizard_step_3();  isset($_session['step3_completed'])     $this->wizard_step_4();  ... 

responses made via xmlhttprequest , expects data in json format. if json returns true, javascript loads next piece of wizard. (usually html forms different tasks.)

i'm wondering if there better , more good-practice wizard alternatives. example, don't know if keeping current step in session or bad practice way.

basically, how design such task yourself, trying use best practices as possible?

thank you.

keeping current step in session variable fine, following practice points:

  1. a wizard method of getting information user in step-by-step fashion. in cases, use can opt out or cancel @ stage. in solution updating columns in database @ each step. while appreciate have isvisible prevent half-filled records causing problems, store information somewhere temporary (such variables) , commit complete record when user hits "finish". of course, exception if loss of user's input issue. eg. in email site not want loss of session mean loss of draft email.
  2. further above point may want store in-progress values in session variable. way application remains unaffected until "atomic" commit @ final stage.
  3. when storing current stage of session, use sequential flag (ie. integer indicates last completed step opposed step_x_completed). way have less state variables , less opportunity error.
  4. security matter, you'd need provide more information environment application in before can discuss security considerations.

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -