Hi There,

What I'm trying to do is the following:

Have a drop down box show what routes are available i.e. Route 1, Route 2,
and Route 3 and then have the map display below the drop down box.

Here is the code that I'm working with:
<script type="text/javascript">
function showUser(str)
{
var url="display_route.php";
url=url+"?r="+str;


if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtRoute").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
</script>
    <!-- necessary for google maps polyline drawing in IE -->
    <style type="text/css">
      v\:* {
        behavior:url(#default#VML);
      }
    </style>
    </head>

<body>
 <center>
 <form method="get" action="" name="form1">

Select a Route:
<select name="users" onchange="showUser(this.value)">
<option value="1">Route 1</option>
<option value="2">Route 2</option>
<option value="3">Route 3</option>
<option value="4">Route 4</option>
</select>
</form>
<br />
<div id="txtRoute"><b>Route displayed here.</b></div>

  </center>
</body>

then calling the map page:

$map = new GoogleMapAPI('map');
 $map->setAPIKey(map key);

 //$viewAddress = mysql_query("select name, address1,address2,city,state,zip
from  tbl_google_map where rout = ".$r." GROUP BY name ") or die
(mysql_error());
 $viewAddress = mysql_query("select name, address1,address2,city,state,zip
from  tbl_google_map  GROUP BY name ") or die (mysql_error());


 while ($loc = mysql_fetch_assoc($viewAddress))
 {
   $name     = $loc['name'];
   $address1 = $loc['address1'];
   $address2 = $loc['address2'];
   $city     = $loc['city'];
   $state    = $loc['state'];
   $zip      = $loc['zip'];

   $location = $address1.'&nbsp;'.$city.'&nbsp;'.$state.'&nbsp;'.$zip;


   $map->addMarkerByAddress($location,$name,'<b>'.$name.'</b>');
   $map->printHeaderJS();
   $map->printMapJS();
   $map->printMap();

Any help would do..

Thanks You,
Kevin Davis

-- 
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.

Reply via email to