Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I am about to go jump off a bridge... I am hoping someone can talk me out of it.
http://beckwiga.homeip.net/maps/markers.php
My page is not displaying in IE. It displays in FF, but my InfoWindows (googleMaps) are not functioning properly. I have searched all over the web, including the googleMaps groups, and know that this has to do with the way my java script is being run. I have been told that I need to move my JS to the <head> which I have tried, but my map page will not load. I'm having trouble understanding where/why IE is struggling. Anybody had to deal with this before? Anyone offer any suggestions as to how I can rearrange my code to get around this? Thanks in advance to anyone who has a look.
I have 2 relevant pages..
---------------
markers.php
---------------Code: Select all
<?php
include ('process.php');
include('config.inc.php');
$mWidth = 1200;
$mHeight = 800;
$mZoom = 5;
list($dbname, $dblink) = DB_CONN();
//error_reporting(E_ALL ^ E_NOTICE);
$markers_name = $_POST['markers_name'];
$markers_comment = $_POST['markers_comment'];
$markers_email = $_POST['markers_email'];
$markers_website = $_POST['markers_website'];
$x = $_GET['x'];
$y = $_GET['y'];
if(!empty($markers_name)) {
$markers_ip = $_SERVER["REMOTE_ADDR"];
$month = date(n);
$day = date(j);
$year = date(Y);
$g = date(g)+1;
$time = date($g.":".i." ".a);
mysql_select_db($dbname, $dblink);
$checklocationquery="SELECT markers_lat, markers_long
FROM markers;";
$checklocationresult=mysql_query($checklocationquery);
$markers_check = mysql_fetch_object($checklocationresult);
if($markers_check->markers_long == $x && $markers_check->markers_lat == $y) {
}
else {
$insertquery="INSERT INTO markers
(markers_lat, markers_long, markers_name, markers_comment, markers_email, markers_website, markers_ip, markers_month, markers_day, markers_year, markers_time)
VALUES ('$x', '$y', '$markers_name', '$markers_comment', '$markers_email', '$markers_website', '$markers_ip', '$month', '$day', '$year', '$time');";
$insertresult = mysql_query($insertquery);
if(!$insertresult) {
echo "Doh! Error inserting your location into database."; exit;
}
}
}
mysql_select_db($dbname, $dblink);
$query="SELECT *
FROM markers;";
$result = mysql_query($query);
if(!$result) {
echo "Doh! Error getting markers from database."; exit;
}
$a = 0;
while ($markers_row = mysql_fetch_object($result)) {
/*$a = 0;
$coord = array('name' => array($a => "$markers_row->markers_name"));
$coord = array('long' => array($a => "$markers_row->markers_long"));
$coord = array('lat' => array($a => "$markers_row->markers_lat"));
$coord = array('comment' => array($a => "$markers_row->markers_comment"));*/
$coord[$a]['long'] = $markers_row->markers_long;
$coord[$a]['lat'] = $markers_row->markers_lat;
$coord[$a]['name'] = $markers_row->markers_name;
$coord[$a]['comment'] = $markers_row->markers_comment;
//$a++;
echo $coord[$a]['long'];
echo $coord[$a]['lat'];
echo $coord[$a]['name'];
echo $coord[$a]['comment'];
$a++;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-t-com:vml">
<head>
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<script src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAA3jEc3SJpbLm866CfKXKmRRRv2OgatP-igFqPyUJ3THPouBSGOhSjKdeZ5tRq9MyQ83A21kBZNuRI7g" type="text/javascript"></script>
<title>Map</title>
</head>
<body>
<div id="main">
<div id="map" style="width: <?php echo"$mWidth"; ?>px; height: <?php echo"$mHeight"; ?>px; color: #000000;"></div>
<?php // Create an instance of the mapping class
$myMarkers = new googleMap;
$myMarkers->showMap($coord, $mZoom);
?>
</body>
</html>--------------
process.php
--------------
Code: Select all
<?php
class googleMap{
function showMap($coord_array, $mapZoom){
//we have to have an address
if (empty($coord_array)){
echo "ERROR: You have not specified an address to map"; exit();
}
//Still needs an error check to make sure that addresses have been found.
echo "
<script type=\"text/javascript\">
//<![CDATA[
if (GBrowserIsCompatible()) {
var icon = new GIcon();
icon.image = \"http://labs.google.com/ridefinder/images/mm_20_red.png\"; //change this to be google default
icon.shadow = \"http://labs.google.com/ridefinder/images/mm_20_shadow.png\";
icon.iconSize = new GSize(12, 20);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);
var icon1 = new GIcon();
icon1.image = \"http://labs.google.com/ridefinder/images/mm_20_red.png\"; //change this to be google default
icon1.shadow = \"http://labs.google.com/ridefinder/images/mm_20_shadow.png\";
icon1.iconSize = new GSize(0, 0);
icon1.shadowSize = new GSize(0, 0);
icon1.iconAnchor = new GPoint(6, 20);
icon1.infoWindowAnchor = new GPoint(5, 1);
var map = new GMap(document.getElementById(\"map\"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.centerAndZoom(new GPoint(-81.99079513549804, 26.544462124910293), ".$mapZoom."); //long,lat
GEvent.addListener(map, 'click', function(overlay, pointa) {
markera = new GMarker(pointa, icon1);
map.addOverlay(markera);
var y = pointa.y;
var x = pointa.x;
markera.openInfoWindowHtml(\"<form name='form1' method='post' action='markers.php?x=\"+x+\"&y=\"+y+\"'><table><tr><td align='right'>Name: </td><td><input name='markers_name' type='text' size='8'></td></tr><tr><td align='right'>Email: </td><td><input name='markers_email' type='text' size='8'></td></tr><tr><td align='right'>Website: </td><td><input name='markers_website' type='text' size='8'></td></tr><tr><td align='right'>Comment: </td><td><textarea name='markers_comment' cols='35' rows='6' wrap='VIRTUAL'></textarea></td></tr><tr><td></td><td><input name='submit' type='submit'value='Post Your Location'></td></tr></table></form>\");
});
";
$numMarkers = sizeof($coord_array);
for ($i=0; $i<$numMarkers; $i++){
echo"
var point".$i." = new GPoint(".$coord_array[$i]['lat'].", ".$coord_array[$i]['long'].");
var marker".$i." = new GMarker(point".$i.", icon);
map.addOverlay(marker".$i.");
var html = \"Long/Lat: ".$coord_array[$i]['name'].", ".$coord_array[$i]['comment']."\"
GEvent.addListener(marker".$i.", \"click\", function()
{marker".$i.".openInfoWindowHtml(\"<b>Lat/Long:".$coord_array[$i]['lat'].",".$coord_array[$i]['long']."<\");
});
//
";
}
echo"}
//]]>
</script>
";
}
}
?>feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
HELP!!