title: Destroy PHP Sessions on Browsers Tab Close
body: <p>i am stucked, i am working on Projects <a href="https://www.hotbartendersla.com/event-booking-step-1/" rel="nofollow">hotbartendersla</a></p>
  
  <p>i have used a lot of sessions to process data in event booking, now i want to destroy the session when user closed the window/tab of browser,because when ever i open site the selection remains same as i did.</p>
  
  <p>i have used this </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    window.onbeforeunload = function() {
  
      $.post("mysessionsdestroypage.php",function(data){
      });  
  
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>but when i jumped to on step 2,step 3, my sessions are destroyed and data don't reached on step 4.
  i searched alot but i found no reliable solution for this</p>