0

I have a two part php form.

Part 1 - Agreement Page. .. you have to accept this to proceed forward to part 2 yes > proceed no > redirect to another page.

Part 2 - form itself. fill form > proceed to thank you.

How do prevent people from going to part 2 directly? ex. part1-p1.php, part2-p2.php. If I load part2-p2.php then it detects that you didn't come from part1-p1.php and redirects you to part1-p1.php.

any snippets or web references would be appreciated.

2 Answers 2

1

You may use Session for this condition, after the user agrees the agreement, set $_SESSION['agree'] = true, when loading part 2, check $_SESSION[agree] first

0

I personally like @LotusH's answer. However I figured I would offer another suggestion in case you are not using sessions (or don't want to for whatever reason).

You could have part1 page post to part 2 page. If the expected POST values for acceptance are not present (or if page2 is not posting back onto itself), you could redirect to the non-acceptance page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.