title: Pass PHP variable with GET to another PHP page
body: <p>There's probably something pretty easy here that I'm missing but I can't seem to figure it out.</p>
  
  <p>I'm trying to pass a PHP variable "$session" from one PHP page to another PHP page using GET. The GET shows in the new URL but the value is not passed to the page so that I can retrieve it. Below is the relevant code.</p>
  
  <p>On the main Index.php page.</p>
  
  <pre><code>&lt;div class="mapgroup"&gt;
    &lt;table&gt;
      &lt;tr&gt;
         &lt;td&gt;&lt;/td&gt;
         &lt;td id="refreshKML" &gt;&lt;/td&gt;
         &lt;?php echo "&lt;td&gt;&lt;a href='3D-Earth.php?session=$session' title='Full Size Google Earth' target='_blank' &gt;Click here&lt;/a&gt; for full size Google Earth&lt;/td&gt;"; ?&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
    &lt;div id="map3d"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The "$session" variable is passed to 3D-Earth.php using GET and the correct value shows in the URL. However, when I try to retrieve the variable with:</p>
  
  <pre><code>&lt;?php
    $session = $_GET["session"];
  ?&gt;
  </code></pre>
  
  <p>and then try to create a javascript variable:</p>
  
  <pre><code>&lt;script&gt;
    var session = &lt;?php echo $session; ?&gt;;
  &lt;/script&gt;
  </code></pre>
  
  <p>that I will use to concatenate the below string:</p>
  
  <pre><code>var href = 'http://localhost/satellites/' + session + '/master.kml';
  </code></pre>
  
  <p>nothing is being passed.</p>
  
  <p>I appreciate any help anyone can provide. Thanks in advance.</p>
  
  <p>Additionally, I've inserted the below code at the bottom of my 3D-Earth.php page to verify that the GET is being passed.</p>
  
  <pre><code>  &lt;div&gt;
      &lt;table&gt;&lt;p style='color:white;' &gt;Hello " &lt;?php echo $session; ?&gt; " world!&lt;/p&gt;&lt;/table&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>The result is an empty string that shows: Hello " " World! Anyone know what I might be doing wrong?</p>