View source on the page should give the answer very quickly. Posting a link here we'll get quite a few eyes helping point out the issue.
Your PHP string looks right to me. Chad Killingsworth On Jul 13, 9:01 pm, "[email protected]" <[email protected]> wrote: > On Jul 13, 11:21 am, Dave H <[email protected]> wrote: > > > I've got a very simple php script that gets values then centres a full > > screen map on specified lat/long. The only problem is that nothing > > displays when I browse to the page. When I use exactly the same HTML > > code but hardcode the Longitude/Latitude, it works perfectly. > > > Any ideas? My code is below > > Post a link, not code, if you do a view source or run it in a browser, > the error should be obvious. > > > > > Thanks > > > <?php > > > $maplat=$_GET['maplat']; > > $maplon=$_GET['maplon']; > > $mapstring = $maplat.', '.$maplon; > > This looks like a string of the form "number,number" > > > > > > > ?> > > > <!DOCTYPE html> > > <html> > > <link href="default.css" rel="stylesheet" type="text/css" /> > > <head> > > <meta name="viewport" content="initial-scale=2.0, user-scalable=no" / > > > <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> > > <title>Google Maps JavaScript API v3 Example: Info Window Simple</ > > title> > > > <script type="text/javascript" src="http://maps.google.com/maps/api/js? > > sensor=false"></script> > > <script type="text/javascript"> > > function initialize() { > > var myLatlng = new google.maps.LatLng(<?php echo $mapstring ; ?>); > > google.maps.LatLng takes two numeric arguments, not a comma separated > string. > > -- Larry > > > > > var myOptions = { > > zoom: 16, > > center: myLatlng, > > mapTypeId: google.maps.MapTypeId.SATELLITE > > } > > > var map = new > > google.maps.Map(document.getElementById("map_canvas"), myOptions); > > > var contentString = '<h2 align="center">Bears Down Reservoir</ > > h2>'+ > > '<h3 align="center">Station</h3>'+ > > '<div id="bodyContent">'+ > > 'Bears Down Reservoir<br />' + > > 'Bears Down Service Resevoir<br />'+ > > 'St Ervan<br />'+ > > 'Cornwall<br />'+ > > 'YO8 8PQ'+ > > '</div>'; > > > var infowindow = new google.maps.InfoWindow({ > > content: contentString > > }); > > > var marker = new google.maps.Marker({ > > position: myLatlng, > > map: map, > > title: 'Bears Down Reservoir' > > }); > > google.maps.event.addListener(marker, 'click', function() { > > infowindow.open(map,marker); > > }); > > } > > > </script> > > </head> > > <body onload="initialize()"> > > <div id="map_canvas"></div> > > </body> > > </html> -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
