title: PHP GET Variable till session running
body: <p>I've designed my project as this structure <code>login.php (to login)</code> <code>-&gt;</code> <code>index.php (to select year) -&gt; dashboard.php (project started)</code>. After login is authenticated, index page is started to select year. And this selected year id is passed to dashboard with javascript.</p>
  
  <p><strong>Index.php</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $('#year').change(function() {
      window.location.assign('dashboard.php?id=' + $(this).val());
  });
      &lt;/script&gt;
  </code></pre>
  
  <p>In dashboard I assign this id as session variable</p>
  
  <p><strong>dashboard.php</strong></p>
  
  <pre><code>   $_SESSION['year_id'] = $_GET['id'];
  </code></pre>
  
  <p>And in every pages I have used <code>$_SESSION['year_id']</code>. It works fine. But problem starts from revisiting dashboard page because <code>$_GET['id']</code> becomes undefined index. And it is not best way to select year again and again. Now I want to store get variable till session running. </p>