URL flow when writing a wizard in PHP
Posted
by Brian
on Stack Overflow
See other posts from Stack Overflow
or by Brian
Published on 2010-05-12T20:02:42Z
Indexed on
2010/05/12
20:04 UTC
Read the original article
Hit count: 311
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
© Stack Overflow or respective owner