Jump to content

Recommended Posts

Hi Everyone,

 

I have a form that is quite long and I would like to separate it into stages. I would like some help on how I should go about this, not any code help but I would like to know the best method for transferring variables from stage to stage.

 

I want to have all stages on one page and I will need to validate before moving to the next stage, only at the last stage should the mySQL insert be called.

 

I was thinking of posting variables from the previous stages into hidden inputs and then re validating on the last stage or maybe using sessions. I was hoping there is a better/more efficient method that I have overlooked.

 

Cheers for any pointers

 

 

Link to comment
https://forums.phpfreaks.com/topic/188894-multiple-stage-form/
Share on other sites

How about using ajax and submitting the details of stage 1 on blur() of the final input for that stage. Something along the lines of how a username field would check for availability when moving to the password field etc...

 

btw- I assume by having all stages on one page you are meaning that all the form fields will be available in one go? Otherwise just store details in a session

Link to comment
https://forums.phpfreaks.com/topic/188894-multiple-stage-form/#findComment-997322
Share on other sites

only at the last stage should the mySQL insert be called

Why?

 

Why not put the data gathered at each step into the database (after you validate it), marked with a 'pending' status?

 

If this form is as long you hint, why not store the data persistently on the server so that if something should happen to cause a problem that would loose any data in a hidden form field or in a session (such as a battery dying, the Internet connection  gets broken, the browser is accidentally closed, the cat chews through the power cord...), that you don't require the visitor to reenter everything from the start?

Link to comment
https://forums.phpfreaks.com/topic/188894-multiple-stage-form/#findComment-997323
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.