title: How pass session variable in javascript
body: <p>Im new for php... I wrote javascript for html.. But i dont know how to write this same javascript concept to php using that sesssion value.. </p>
  
  <p>My session value:</p>
  
  <pre><code>$_SESSION['line2'],
  
  $_SESSION['oline2']
  </code></pre>
  
  <p>My javascript code here:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function showLocation() {
              var geocoder, location1, location2, gDir;
  
              geocoder = new GClientGeocoder();
              gDir = new GDirections();
              GEvent.addListener(gDir, "load", function() {
                  //var drivingDistanceMiles = gDir.getDistance().meters / 1609.344;
                  var drivingDistanceKilometers = gDir.getDistance().meters / 1000;
                 // var miles = drivingDistanceMiles ;
                  var km = drivingDistanceKilometers;
                  //document.getElementById('miles').value = miles;
                  document.getElementById('km').value = km;
                 
              });
  
  geocoder.getLocations(document.getElementsByName("addressline2")[0].value, function (response) {
                  if (!response || response.Status.code != 200)
                  {
                      alert("Sorry, we were unable to geocode the first address");
                  }
                  else
                  {
                      location1 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address};
                      geocoder.getLocations(document.getElementsByName("officeaddressline2")[0].value, function (response) {
                          if (!response || response.Status.code != 200)
                          {
                              alert("Sorry, we were unable to geocode the second address");
                          }
                          else
                          {
                              location2 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address};
                              gDir.load('from: ' + location1.address + ' to: ' + location2.address);
                          }
                      });
                  }
              });
          }   
        </code></pre>
  </div>
  </div>
  </p>
  
  <p>Anyone help </p>