Php – jQuery and/or PHP location finder: zip code and city/state

geolocationjquerylocationPHPzipcode

I'm looking to auto-populate a form input textarea with the user's city, state. I also need the zip code to pass with the form. I don't need a map.

Any suggestions? (I prefer jQuery and/or PHP.)

UPDATE
I discovered this little js to get the city, state, latitude, longitude, area code, etc… except it doesn't get the zip. Probably because a lot of cities have multiple zips. But all I need is one zip from the city… it doesn't matter which one, because I'm grabbing data within a 50 mile radius. So is there anyway to take this script below and find a zip from the location based on the data that it returns.

<html>
<head>
    <script language="JavaScript" src="http://www.geoplugin.net/javascript.gp" type="text/javascript"></script>
</head>
<body>
    <script language="Javascript"> 
document.write("Welcome to our visitors from "+geoplugin_city()+", "+geoplugin_region()+", Area code = "+geoplugin_areaCode()+", Latitude = "+geoplugin_latitude()+geoplugin_areaCode()+", Longitude = "+geoplugin_longitude()); 
    </script>
</body>
</html>

Source: GeoPlugin

Best Answer

You can use GeoLite City to convert the user's IP into the City, State Zip