This code works perfectly in the fact that it gets my longitude and latitude via javascript, and outputs to the screen. But I want to pass these values to a PHP variable, here is what I currently have. I'm not a javascript expert, although I have spent 5 to 6 hours researching and trying different things before I ask Stackoverflow. Thanks for any help.
    <!DOCTYPE html>
    <html>
    <body>
    <p id="long"></p>
    <p id="lat"></p>
    <script>
    var x = document.getElementById("long");
    var y = document.getElementById("lat");
    if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(showPosition);
    } else { 
    x.innerHTML = "Geolocation is not supported by this browser.";
    }
    function showPosition(position) {
    x.innerHTML = position.coords.longitude;  //displays longitude on screen
    y.innerHTML = position.coords.latitude;  //displays latitude on screen
    }
    </script>
    <?php 
    echo $plong = '<script>x.innerHTML = position.coords.longitude;</script>';
    echo $plat = '<script>y.innerHTML = position.coords.latitude;</script>';
    echo "long " . $plong;
    echo "lat " . $plat;
    ?>
    </body>
    </html>
