Skip to content Skip to sidebar Skip to footer

Multiple Pages In A Form

I recently built a simple website for a client having very little content, images and pages. Now, they want a form (a very complicated) one on their website. I built their website

Solution 1:

You can handle the variables with GET and POST methods also you can save variables in SESSION.

So, when you can handle this variables in the chaining pages. In your forms you might use hidden inputs to send again another page to handle this variables again. At the end of the process you can updat or save your entity or entities in your database.

Solution 2:

Ajax.

You can use ajax and save data in session to wait last step.

jQuery Ajax POST example with PHP

Display cssRules.

http://jsbin.com/vofoz/1/edit

You make div for each step like and show next step with JS. Like this :

<form><divid="step1">
        step 1
        <inputtype="button"value="next >" /></div><divid="step2"style="display:none;">
        step 2
        <inputtype="button"value="next >" /></div><divid="step3"style="display:none;">
        step 3
        <inputtype="submit" /></div></form>

Sample example (javascript) :

$("form div > input[type=button]").click(function () {
    $(this).parent().hide();
    $(this).parent().next().show();
});

Solution 3:

I would include everything needed in one big form, then show/hide content to paginate the form. This would reduce the request to the server by grouping everything in one POST. As long as there's a single <form> tag wrapping everything, it will be relatively simple.

Post a Comment for "Multiple Pages In A Form"