Hi Goodmorning. I'm developing an online add cart. my problem is when a user confirm payment and after a second he/she pressed escape. payment is successful but my email notification did not sent. how will i detect if a user pressed escape.

Thank you.

Do you mean the user pressing the esc key on the keyboard? If so, that would be handled client side, not in your PHP code.

For example..here is an example, but written in jQuery...

$(document).keyup(function(e) {

  if (e.keyCode == 27) 
  { 
    // do some work here because the user hit the esc key
    alert("You hit the ESC key");
  }

});

Thanks sir. But had already try this javascript but it doesn't work in my response page.

I would suggest you revisit why the javascript approach did not work for you. Did you get an error?

To solve you problem, I only see that a client side solution will work.