Let's take this topic a step higher.
I came across a script gives you the latitude and longitude values on an address
This works.
Now I like to take the values from 'Address' and 'City' from my Table copied into this script and then the value of $lat en $log should be added to the fields 'Latitude' and 'Longitude'. when a new client is added to my database.
I think this needs to be done in 'Before record added' in the Add Page.
I came across a script gives you the latitude and longitude values on an address
<?php // Fixed addresses from the example, they work! //$address = "1600 Pennsylvania Ave NW Washington DC 20500"; //$address = str_replace(" ", "+", $address); //$region = "USA"; $address = $values['Adres']; $city = $value['Woonplaats']; $combinedAddress = $address . ',' . $city; $region = "Europe"; $json = file_get_contents("http://maps.google.com/maps/api/geocode/json?address=$address&sensor=false®ion=$region"); $json = json_decode($json); $lat = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lat'}; $long = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lng'}; echo $lat." ".$long;
This works.
Now I like to take the values from 'Address' and 'City' from my Table copied into this script and then the value of $lat en $log should be added to the fields 'Latitude' and 'Longitude'. when a new client is added to my database.
I think this needs to be done in 'Before record added' in the Add Page.