title: How can I clear my php session data correctly?
body: <p>My php website flows like this:</p>
  
  <ul>
  <li>Page1.php has an html form which POSTs to Page2.php </li>
  <li>Page2.php stores all the POST data into SESSION variables and has a button leading to Page3.php</li>
  <li>Page3.php has another form which POSTs its data to Page4.php</li>
  <li>Page4.php then stores all its POST data into SESSION variables</li>
  </ul>
  
  <p>My problem is that it may be nessicary for a user to click the back button on Page4.php to go back to Page3.php and change some input. AS im sure your all aware when they get back to Page3.php the form will be blank as the entire page is re-rendered in its default state. </p>
  
  <p>To get around this and re-display the user's previous input im  doing this:</p>
  
  <pre><code>&lt;input value="&lt;?php echo $_POST["guest1Ticket"];?&gt; " type="text"  name="guest1Ticket" id="guest1Ticket" onblur="isTicketNumber(this)"  size ="22"/&gt;
  </code></pre>
  
  <p>This being the important part - <code>&lt;?php echo $_POST["guest1Ticket"];?&gt;</code></p>
  
  <p>This works but creates another problem for me. If the user goes back to Page1.php (before colsing their browser) and starts the process over again when they get to Page3.php the data from their last run through will be loaded into the form. </p>
  
  <p><strong>What I figure I need to do is clear all of the sdession variables when the user visists Page1.php. I tried to to that like this:</strong></p>
  
  <pre><code>&lt;?php 
   session_start(); 
   session_unset(); 
   session_destroy(); 
  ?&gt; 
  </code></pre>
  
  <p><strong>(The above is at the very top of my file with no whitespace before the first character.)</strong></p>
  
  <p>No Warnings are generated when Page1.php loads but the session variables are not getting unset. When I get to Page3.php the data from the last run is still being entered into the form.</p>
  
  <p><strong>How can I clear my session data correctly?</strong></p>
  
  <p>BTW <strong>I only need this to work in Chrome</strong> and thats where im testing.</p>