Inserting JavaScript into PHP
Posted: Mon Jul 16, 2007 8:42 pm
I'm trying to write a PHP script that creates an XML file (KML format)
that can be interpreted by Google Maps. However, I don't have the
coordinate information for my data, so I need to geocode the address.
However, Google Maps only uses JavaScript for geocoding addresses, and I've
been unsuccessful in inserting the JavaScript function into the PHP code.
Any help would be greatly appreciated.
This is the JavaScript function used to geocode the address.
This is the relevant part of the PHP code that defines the coordinates.
I've tried various ways to successfully syntax the code but none have worked. None of the forums out there talk about this specific problem.
that can be interpreted by Google Maps. However, I don't have the
coordinate information for my data, so I need to geocode the address.
However, Google Maps only uses JavaScript for geocoding addresses, and I've
been unsuccessful in inserting the JavaScript function into the PHP code.
Any help would be greatly appreciated.
This is the JavaScript function used to geocode the address.
Code: Select all
function showAddress(address) {
geocoder.getLatLng(
address,
function(point) {
var marker = new GMarker(point);
map.addOverlay(marker);
}
);
}This is the relevant part of the PHP code that defines the coordinates.
Code: Select all
$Coordinates->appendChild($dom->createTextNode(/* Insert JavaScript here */));