php - clearing two dimensional session array using jsp


i have a two dimensional session array and i'm trying to clear it after the bill is printed. to do so i'm using this code

<script type="text/javascript">
    function textsizer(e) {
    var evtobj=window.event? event : e;
    var element = ? : evtobj.srcElement;
    if (element.tagName.toLowerCase() == "body") {
        var unicode=evtobj.charCode? evtobj.charCode : evtobj.keyCode;
        var actualkey=String.fromCharCode(unicode)
            function show_confirm(){
            var con = confirm("Are You Sure you wan to cancel this bill?");
            if (con ==true){
            alert("You pressed Cancel!");

but this code is not clearing the session. i tried it using google chrome and internet explorer but didn't work. can anyone help me on this thing? i also tried to do it with php but it also didn't work for me. my case i want to delete session by pressing x on key board there is no matter what is the language, i just want to clear the session pressing x key




You could use JavaScript to capture when the 'x' key is pressed, and redirect to a PHP page to clear the session. So you want something along the lines of:

//Your main page
<script type='text/javascript'>
window.onkeypress = function() {
    if (event.keyCode == 88) {
        window.location = 'clear_session.php';

header ("Location:main_page.php"); //redirect back to main page

People are also looking for solutions to the problem: wordpress - Combine these basic php functions


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.