title: Passing variable from JavaScript to PHP without using Query String
body: <p>How can I pass the longitude and latitude from the below code to my PHP code?</p>
  
  <pre><code>function getLocation() {
      if (navigator.geolocation) {
          navigator.geolocation.getCurrentPosition(showPosition);
      }
  }
  function showPosition(position) {
      document.getElementById("getlat").value = position.coords.latitude;
      document.getElementById("getlon").value = position.coords.longitude;
  }
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;input type="hidden" id="getlat" name="getlat" value="&lt;?php echo $_SESSION['polat']; ?&gt;" /&gt; 
  &lt;input type="hidden" id="getlon" name="getlon" value="&lt;?php echo $_SESSION['polon']; ?&gt;" /&gt;
  </code></pre>
  
  <p>PHP Code</p>
  
  <pre><code>$lat = '-27.486204'; // Should get latitude from JS here.
  $long = '152.994962'; // Should get longitude from JS here.
  
      mysqli_query("SELECT * From `table_nme` where `latitude`='.$lat.' AND `longitude`='.$long.'");
  </code></pre>
  
  <p>I know how to do this in Query String Process but I need it without Query String Process.</p>