I have a table of stockists that are searchable through a form the query from the form returns the values
stockist.php?brand=brandname&retailer=Cork&submit_it=
My marker page which is in XML can all the stockists from the stockists table but will not pull out anything from the query string ( there are values that match in the database ).
The google xml page is really simple see below;
$name = $_GET['retailer'];
// Select all the rows in the markers table
$query = "SELECT * FROM stockists WHERE county = $name";
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
header("Content-type: text/xml");
// Start XML file, echo parent node
echo '<markers>';
// Iterate through the rows, printing XML nodes for each
while ($row = @mysql_fetch_assoc($result)){
// ADD TO XML DOCUMENT NODE
echo '<marker ';
echo 'name="' . parseToXML($row['stockist_name']) . '" ';
echo 'address="' . parseToXML($row['stockist_address']) . '" ';
echo 'lat="' . $row['lat'] . '" ';
echo 'lng="' . $row['lng'] . '" ';
echo '/>';
}
// End XML file
echo '</markers>';
but it is called from within a javascript function on another page see below;
GDownloadUrl("mappage.php", function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var address = markers[i].getAttribute("address");
var type = markers[i].getAttribute("type");
var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var marker = createMarker(point, name, address, type);
map.addOverlay(marker);
}
});
}
}
Could this have anything to do with why the variable is not passing. I've looked around the web and couldn't find anywhere where the map markers are being shown on the basis of a query, so any help would be greatly appreciated.
thanks