Código HTML:
var marker; function initialize() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(4.685555,-74.054852), 13); GEvent.addListener(map, "click", function(overlay, latlng) { if (latlng) { marker = new GMarker(latlng, {draggable:true}); var lng= latlng.lng(); var lat= latlng.lat(); GEvent.addListener(marker, "click", function() { var html = "<form id='form1' name='form1' action='mostrar.php' >"+ "<table>" + "<tr><td>Numero servicio:</td> <td><input type='text' id='name'/> </td> </tr>" + "<tr><td>Direccion:</td> <td><input type='text' id='address'/></td> </tr>" + "<tr><td>tipo:</td> <td><select id='type'>" + "<option value='grua' SELECTED>grua</option>" + "<option value='moto'>moto</option>" + "<option value='vehiculo'>vehiculo</option>" + "</select> </td></tr>" + '<tr><td><input type="text" id="Longitud" value="'+lng+'"/></td> </tr>'+ '<tr><td><input type="text" id="Latitud" value="'+lat+'"/></td> </tr>'+ "<tr><td></td><td><input type='submit' value='Guardar y cerrar' onclick='saveData()'/></td></tr>"; marker.openInfoWindow(html); }); map.addOverlay(marker); } }); } } function saveData() { var name = escape(document.getElementById("name").value); var address = escape(document.getElementById("address").value); var type = document.getElementById("type").value; var latlng = marker.getLatLng(); var lat = latlng.lat(); var lng = latlng.lng(); var url = "mostrar.php?name=" + name + "&address=" + address + "&type=" + type + "&lat=" + lat + "&lng=" + lng; GDownloadUrl(url, function(data, responseCode) { if (responseCode == 200 && data.length <= 1) { marker.closeInfoWindow(); document.getElementById("message").innerHTML = "Location added."; } }); } </script> </head> <body onload="initialize()" onunload="GUnload()"> <div id="map_canvas" style="width: 1000px; height: 800px"></div> <div id="message"></div> </body> </html>