I'm using the google maps API to get a city based on the latitude and longitude of the persons geo-location. I want to take the city name and be able to: display the name, use it as a variable or hidden form field. I found some great code online that runs a lot of this and I've got the code below working to display the city name on the page, however I don't know how to get this into a PHP variable. I'm not very fluid with Javascript so any help would be awesome. Here is the code I have, how do I get the "geo" ID into a PHP variable or even into a hidden form field I can post to another page:
<script language="JavaScript">function updatePage() {if (xmlHttp.readyState == 4){var response = xmlHttp.responseText; document.getElementById("geo").innerHTML = response;}} </script> <? echo "<span id=\"geo\"></span>"; ?>