URL flow when writing a wizard in PHP
- by Brian
Hello,
I am writing a basic wizard for my web site. It will have 4 steps, and each needs to have its own URL. Each step must first validate a form before moving on.
If the form for a given step fails to validate, I don't want the URL to change. But if it passes, I do want it to move on.
What is the preferred way to write this? Using javascript alone to validate is not secure enough. I have 2 ideas so far but I don't love either:
1) Post the form to the same script and use a header() redirect to the next step if it passes.
2) Send an ajax post to validate and then use location.href to send user to the next step if it passes.
Is there a better way to do this?
Thanks, Brian