Question: I have a very complicated form which has multiple "stages" in it.

Each stage has forms where the user adds indefinite numbers of rows. Each time the user clicks "continue" these forms save to the database (each "stage" has its own table in the database) and the next stage is shown.

I'm worried about users pressing "back" in order to get the the previous form (if they've made a mistake or something).

The only three ways I can think to solve this problem is:

1. Disallow people to press back. If they do send them straight to the first form to start again.
2. Check the database when the form page is requested. If there are rows already then delete those rows and start the user again on the form they're on.
3. [potential - This is going to be harder because I'm using codeigniter's form\_validation library] Check the database when users press back. Get any current values out and put into the form as default values. Then on submit, remove any rows and replace with form values.

How do you guys do this kind of form? Its getting really ridiculous the amount of logic just for some forms! haha, is there a better way to do this? I suspect that number 3 above is the best option?

Thanks

Answer: 
I have used the third option on various occasions, though depending on the size of the form, this can certainly get overwhelming, not to mention the fact that I haven't used CodeIgniter's validation before. 

Many issues arise from the first two options that should be avoided if possible [Including, but not limited to: Mistakes that aren't able to be corrected, hairy database logic, etc.], but the reward of having happy users is invaluable.

Hope this helps!

Mason

To give a visual summary of what users may think if they can't go back, I have included this image.

<http://momentumshift.com/wp-content/uploads/2011/05/senior_woman_using_computer_mon142089.jpg>
1 and 2 are both very bad for UX. 3 is your best bet, and depending on your db structure you might be able to update instead of delete and re-insert.

If you have a key, which i assume you do, in order to differentiate multiple form submissions, you can use something like `insert on duplicate key update` depending on you db engine.