Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.it/maps?q=<?php echo $yourAddress; ?>&output=embed"></iframe>
- <head>
- ...
- <script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
- <script>
- var geocoder;
- var map;
- function initialize() {
- geocoder = new google.maps.Geocoder();
- var mapOptions = {
- zoom: 12, //Change the Zoom level to suit your needs
- mapTypeId: google.maps.MapTypeId.ROADMAP
- }
- //map_canvas is just a <div> on the page with the id="map_canvas"
- map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
- //Your Variable Containing The Address
- var address = "<?php echo $AddressVariable; ?>";
- geocoder.geocode( { 'address': address}, function(results, status) {
- if (status == google.maps.GeocoderStatus.OK) {
- map.setCenter(results[0].geometry.location);
- //places a marker on every location
- var marker = new google.maps.Marker({
- map: map,
- position: results[0].geometry.location
- });
- } else {
- alert('Geocode was not successful for the following reason: ' + status);
- }
- });
- }
- </script>
- ...
- </head>
- <body onload="initialize()">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement