Hi, I was wondering if you've managed to fix this problem? I am trying to do the same thing and don't know what to do. I want to tailor the results (markers) based on the user's search. However whenever I try to modify the SQL query in genxml.php (by making a comparison with what the user entered), no xml gets generated and the map doesn't even load.
Any help would be most appreciated. Thanks. On Dec 11, 4:03 am, bryanb <rbbo...@comcast.net> wrote: > Hi, > > I've literally been working on this all day. > > I have pretty much just copied the code from Google's Example of thePHP/mysql > marker plotting example, but I am trying to implement the > map each time someone searches my form so that the markers come up as > related to their search query. > > I have a hidden variable that is just a rand () functino that I > entered into the search form and goes to the form action page and the > mysql table, but I can't figure out how to match the variable from the > $_POST & theXMLparse from the javascript. > > PLEASE PLEASE HELP (code example below) > > <script src="http://maps.google.com/maps?file=api&v=2&key=XYZ" > type="text/javascript"></script> > <script type="text/javascript"> > //<![CDATA[ > function load() { > if (GBrowserIsCompatible()) { > var map = new GMap2(document.getElementById("map")); > map.addControl(new GSmallMapControl()); > map.addControl(new GMapTypeControl()); > map.setCenter(new GLatLng(39.953618, -75.164015), 9); > > GDownloadUrl("Marketing/Maps/phpsqlajax_genxml2.php", function(data) > { > varxml= GXml.parse(data); > var markers =xml.documentElement.getElementsByTagName > ("marker"); > > ///THIS IS WHERE I THINK I AM LOST I WANT TO DO SOMETHING LIKE > //////////////// > > var map_var = markers.getAttribute("map_var"); > > //////////////// > //BUT I THINK I AM MESSING UP THE LOOPS > //HOW TO I LINK > // **markers.getAttribute("map_var")** AND **<?php$_POST['map_var']?>** > > ////// > ///////////// > > if (var map_var = <?php$_POST['map_var']?>{ > for (var i = 0; i < markers.length; i++) { > var name = markers[i].getAttribute("ID"); > var address = markers[i].getAttribute("location"); > var point = new GLatLng(parseFloat(markers[i].getAttribute > ("lat")), > parseFloat(markers[i].getAttribute > ("lng"))); > var marker = createMarker(point, name, address); > map.addOverlay(marker); > } > }); > } > } > function createMarker(point, name, address) { > var marker = new GMarker(point); > var html = "<b>" + name + "</b> <br/>" + address; > GEvent.addListener(marker, 'click', function() { > marker.openInfoWindowHtml(html); > }); > return marker; > } > //]]> > </script> > <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></ > script> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to Google-Maps-API@googlegroups.com To unsubscribe from this group, send email to google-maps-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---