All right?
I have a PHP script that converts the ZIP code into a Coordinate and would like it to automatically convert to the value of an input.
<input type="text" value="" id="cep" >
<input type="text" value="" id="latitude">
<input type="text" value="" id="longitude">
<?php
$cep = '01311-100';
$geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$cep.'&sensor=false');
$output= json_decode($geocode);
$lat = $output->results[0]->geometry->location->lat;
$long = $output->results[0]->geometry->location->lng;
echo $lat;
echo $long;
?>
In this above it transforms the cep of $ cep into coordinate, but wanted that when inserting the cep in the input it already converted and put the latitude and longitude in the corresponding inputs.
These values will be inserted into a mysql table.
Thank you!