0

checkout.php:

<form action="success.php" method="post">
    <input name="firstname">
    <button type="submit">Order now</button>
</form>

success.php:

if ( !empty($_POST)) {
  echo "Hello ".$_POST['name'].". Your order was successful"
}

After ordering my customer gets to the success.php page. I want to prevent now that by clicking on the "back button" of the browser the user gets back to the checkout.php. I wish he would go to my index.php. Is this possible?

P. Frank
  • 5,691
  • 6
  • 22
  • 50
peace_love
  • 6,229
  • 11
  • 69
  • 157
  • 2
    http://stackoverflow.com/questions/3460440/how-to-stop-someone-from-going-back-to-previous-page – ka_lin Oct 17 '16 at 13:34
  • 1
    store session in your success.php, then check if is session set in your previous page and if is, redirect to index.php, clear session after new order – Pepo_rasta Oct 17 '16 at 13:36
  • 1
    *"Is this possible?"* - Yes it is possible and there are many scripts out there. If you haven't been looking, then look. If you didn't find anything that fits the bill, then keep looking or post what you tried to work with and may have failed you. – Funk Forty Niner Oct 17 '16 at 13:36
  • @ka_lin and Pepo_rasta Very good advices, thank you very much. I wouldn't have thought of this! – peace_love Oct 17 '16 at 13:38
  • @Maurize That's a JS solution. If a user disables JS, that method will be of no use to them. – Funk Forty Niner Oct 17 '16 at 13:45
  • @Fred-ii- my mistake. missed the tag. –  Oct 17 '16 at 13:47

0 Answers0