title: Start session after destroy php
body: <p>I have a logout file for my web application. I would like to create a session after the logout so that I can echo a logout success message. My logout code works but I am unable to create a new session after destroying the previous one.</p>
  
  <p>What is the best way to do this, see code:</p>
  
  <pre><code>//LOGOUT.PHP
  session_start(); 
  
  //// unset all $_SESSION variables
  session_regenerate_id();
  session_unset();
  session_destroy();
  
  $_SESSION['logoutsuccess'] = 'You have successfully logged out.';
  header("Location: /login/");
  exit;
  
  
  //LOGIN.PHP (ECHO SUCCESS MESSAGE)
  
  if(isset($_SESSION['logoutsuccess']))
  {
  echo '&lt;div class="success"&gt;'.$_SESSION['logoutsuccess'].'&lt;/div&gt;'; 
  unset($_SESSION['logoutsuccess']);
  }
  </code></pre>
  
  <p>I would like to avoid passing variables in the url if possible.</p>