Page 1 of 1

lost with back button

Posted: Wed Feb 01, 2006 6:19 pm
by tim_kinder
Hello,

I have the following scenario :

1. p1.php has a href link to p2.php

2. p2.php has a form (method="post") which submits to do_request.php

3. do_request.php updates back-end database, $_SESSION and redirects to c1.php using Header("Location: c1.php");

4. c1.php has a form (method="post") which submits to do_request.php
do_request.php updates back-end database, $_SESSION and redirects to c2.php using Header("Location: c2.php");

5. c2.php set some flag in $_SESSION, then submits to do_request.php

6. do_request.php updates back-end database, $_SESSION and redirects to p3.php using Header("Location: p3.php");

At this point if I click on back button I want to skip c2.php and c1.php, and jump directly to p2.php; and if I click on back button again - jump to p1.php, etc.

In order to do this, I put conditional Header("Location: p2.php"); in c1.php and c2.php

But what happens - when I click on back button from p3.php - it jumps to c2.php and then does redirection to p2.php, but consider itself as c2.php (?) - so when I click on back button again, expecting to see p1.php - it brings me to c1.php and then redirects to p2.php again!

One more click on back button - and it shows p2.php again, as a predecessor of c1.php, and only next click on back button will bring me to p1.php

-----------------------------------------------

So what could be a solution to jump from p3.php to p2.php and then p1.php?

Sincerely,

Tim Kinder

Posted: Wed Feb 01, 2006 9:42 pm
by feyd
It seems the redirection is useless. Why not simply include() these startup scripts into p2?