Page 1 of 1

Google maps code help please?????

Posted: Mon Sep 12, 2005 12:50 pm
by widdi
Hi Please help - I have followed this code: http://www.map-server.com/googlemaps/tu ... iting.html

to produce an interactive map - but I want more fields?

Could you please help? this is my script where I have modified the code for more fields (and added the collums in the mysql)

I get the error: Due to an error (Unknown column 'wwe' in 'field list') unless I put the collum names in the field boxes!!

Have you come across this??

my problem is at http://www.little-planet.net/add.php Clisk on the map - fill in the fields and submit!

Tankyou

Code: Select all

GEvent.addListener(map, 'click', function(overlay, point) {
if (overlay) {
//map.removeOverlay(overlay);
} else if (point) {

output.innerHTML = "<form name=form1 method=post action=subfinder_load_db.php><table border=0>
<tr><td>Lat:</td><td align=left><input name=new_lat type=text id=new_lat value=" + point.y + "></td><td rowspan=4><input name=new_marker type=radio value=A checked>Active<br><input name=new_marker type=radio value=M>Museum<br><input name=new_marker type=radio value=S>Sunk<br><input name=new_marker type=radio value=E>Event</td></tr>
<tr><td>Lon:</td><td align=left><input name=new_lon type=text id=new_lon value=" + point.x + "></td></tr>
<tr><td>Text:</td><td align=left><input name=new_desc type=text id=new_desc size=60></td></tr>
<tr><td>URL:</td><td align=left><input name=new_url type=text id=new_url size=60></td></tr>
<tr></td><td align=left><input type=submit name=Submit value=Submit></td></tr></table></form>";

if (map.getZoomLevel() >= zoomToLevel) {
map.centerAndZoom(point, zoomToLevel);
}
map.addOverlay(new GMarker(point));

Code: Select all

<?php

include_once("conf.php");

echo "<html><head><link href=\"/style/hans.css\" rel=\"stylesheet\" type=\"text/css\">";
echo "</head><body>";
echo "Lat: " . $new_lat . "<br>";
echo "Lon: " . $new_lon . "<br>";
echo "Text: " . $new_desc . "<br>";
echo "URL: " . $new_url . "<br>";
echo "Marker: " . $new_marker . "<br>";
echo "Name: " . $new_sub_name . "<br>";
echo "Website: " . $new_sub_web . "<br>";
echo "Place: " . $new_sub_place . "<br>";
echo "Country: " . $new_sub_country . "<br>";
echo "Will now be added to the database...";

$new_desc = addslashes($new_desc);
$link = mysql_connect($dbserver, $username, $password) or die("Could not connect: " . mysql_error());
mysql_select_db("cole_test",$link) or die ("Can\'t use dbmapserver : " . mysql_error());
$sql = "INSERT INTO subfinder ";
$sql = $sql . "VALUES ('','".$new_lat."','".$new_lon."','".$new_desc."','".$new_url."','".$new_marker ."'," . $new_sub_name . "," . $new_sub_web . "," . $new_sub_place . "," . $new_sub_country . ")";
$result = mysql_query($sql ,$link);
if (!$result)
{
echo "<p>Due to an error (" . mysql_error() . ")<br>, your entry could not be loaded into the database. Please return to <a href=\"subfinder.php\">Subfinder</a>.";
} else
{
echo "<p>Your entry has been loaded into the database. Please return to <a href=\"index.php\">Little-planet</a>.";
}

echo "</body></html>";
?>
:o :)

Re: Google maps code help please?????

Posted: Mon Sep 12, 2005 2:09 pm
by anjanesh
Excellent reference btw.
Google is coming up with so many types of APIs that I think it'll be good to have a separate sub-forum for 'remote' API coding.

Posted: Mon Sep 12, 2005 5:42 pm
by timvw