Hi, I searched the groups already but couldn't find an answer to my specific prob.
Basically it is about how to transfer a js variable within the function createMarker into the var html = " " where in the " " I do execute php. First of all, here is the link: http://www.moneylando.com/finance-map.html The concept is: 2 tables, in the first one all the location data of the branches, in the second all reviews written. Now, when you click on one marker the bubble opens and shows the branch info and the reviews written and the box to write a new review. It works well, except the fact that I cannot address the reviews in the second table. Now, for every marker ALL reviews are shown. But it only works well because I placed the number 65 in the code instead of the variable. E.g. if I click on marker no. 65, I want only the reviews with the branch_id 65. We talk about the variable branch_id. In the function createMarker I need to read the content of this variable and input it into the query "<?php ... WHERE branch_id = {here should the content of the js var branch_id be placed} ORDER BY date DESC LIMIT 4...?>" I don't know if this becomes clear, please let me know, I'll try to explain further. Here is the code I did so far: function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(25.057461, 121.547569), 13); GDownloadUrl("php/phpsqlajax_genxml.php", function(data) { var xml = GXml.parse(data); var markers = xml.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { var branch_id = markers[i].getAttribute("branch_id"); var name = markers[i].getAttribute("name"); var address = markers[i].getAttribute("address"); var phone = markers[i].getAttribute("phone"); var classifi = markers[i].getAttribute("classifi"); var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); var marker = createMarker(point, name, address, phone, classifi, branch_id); map.addOverlay(marker); } }); } } function createMarker(point, name, address, phone, classifi, branch_id) { var marker = new GMarker(point, customIcons[classifi]); markerGroups[classifi].push(marker); var html = "<div class='maps_total_marker'><b>" + name + "</b> <br/>" + address + "<br/>" + phone + "<br>" + classifi + "," + branch_id + "<br><hr width=100%>最近的客戶意見:<br><?php include 'php/ include.php';include 'php/function.php';$sql='SELECT name, rating, review, date FROM expert_accountants_reviews WHERE branch_id = XXXX ORDER BY date DESC LIMIT 4';$result=sendsql($sql);print '<table cellpadding=0 cellspacing=0 class=map_review_table>';while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo '<tr><td class=map_review_table_1st_row>'.$row[name].', '.$row[date].' <img src=img/star'.$row[rating].'.gif></td></tr><tr><td class=map_review_table_2nd_row>'.$row[review].'</td></tr>';} print '</ table>'; ?><br>寫評論關於這家公司:<br><form action='php/insert_review.php' method='post' class='map_review_bubble'><input type='hidden' name='branch_id' value='" + branch_id + "'><input type='text' name='name' value='輸入您的名字' style='width:150px'/><input type='text' name='email' value='輸入您的email' style='width:150px'/><select name='rating'><option value='5'>5顆星</option><option value='4'>4顆星</ option><option value='3'>3顆星</option><option value='2'>2顆星</ option><option value='1'>1顆星</option></select><br><input type='text' name='review' style='height:50px;width:400px' /><br><input type='submit' id='submit' value='出發' /></form><br></div>"; GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(html); }); return marker; } function toggleGroup(classifi) { for (var i = 0; i < markerGroups[classifi].length; i++) { var marker = markerGroups[classifi][i]; if (marker.isHidden()) { marker.show(); } else { marker.hide(); } } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" 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-API?hl=en -~----------~----~----~----~------~----~------~--~---
