Jimesh Gajera
Jimesh Gajera

Reputation: 612

how can i redirect on the home page when i click on browser's back button

i have ecommerce website in which we use shopping cart page when any person purchase product and paid the payment then we have thank you page,

home page => products => shopping cart => proceed payment => thank you

now when i click on the browser's back button it is going in proceed payment page and give a errors of session.

i want to go back on home page when i click on browser's back button in thank you page.

proceed payment => thank you => home page.

Upvotes: 4

Views: 1658

Answers (1)

Emil Vikström
Emil Vikström

Reputation: 91983

On the thank you page, set a flag in the session. On previous pages, check this flag. If it is set, send the user to the first page using header('Location: ...'); (don't forget to run exit; directly after the header line).

Upvotes: 1

Related Questions