Solution to this
=============================================================================
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Geocoding3 POST METHOD</title>
<script src="http://maps.google.com/maps?
file=api&amp;v=2.x&amp;key=Input your goog maps key here"
        type="text/javascript"></script>
<script type="text/javascript">

var geocoder;
function initialize() {
        if (GBrowserIsCompatible()){
        geocoder = new GClientGeocoder();
   }
}

function showLatLong(response) {

        if (!response || response.Status.code != 200) {
          alert("Sorry, we were unable to geocode that address");
        } else {
          place = response.Placemark[0];
          point = new GLatLng(place.Point.coordinates[1],
                     place.Point.coordinates[0]);

          lat = point.lat();
          lng = point.lng();

          document.getElementById("my_lat").value = lat;
          document.getElementById("my_lng").value = lng;

          postSubmitHiddenForm(lat,lng);
        }
}

// showLocation() is called when you click on the Search button
// in the form.  It geocodes the address entered into the form
// and adds a marker to the map at that location.

   function showLocation() {
     var address = document.forms[0].q.value;
     geocoder.getLocations(address,showLatLong);
    }

// findLocation() is used to enter the sample addresses into the form.

    function findLocation(address) {
      document.forms[0].q.value = address;
      showLocation();
    }


// postSubmitHiddenForm() is used to send the hidden form containing
Latitude and Longitude via a POST request.

function postSubmitHiddenForm(Lat,Lng) {
  document.myHiddenForm.LAT.value=Lat;
  document.myHiddenForm.LNG.value=Lng;
  document.myHiddenForm.submit();
}


    </script>
  </head>

  <body onload="initialize()">

    <!-- Creates a simple input box where you can enter an address
         and a Search button that submits the form. //-->

         <!-- action="http://localhost/~ju/script.php"; method="POST"
onsubmit="showLocation();" -->
    <form action="script.php" method="GET"  name="gForm">
      <p>
        <b>Search for an address:</b>
        <input type="text" name="q" value="" class="address_input"
size="40" />


      <input type="button" name="validate" value="Validate"
onclick="showLocation();">

      </p>
    </form>

    <form name="myHiddenForm" method="post" action="script.php">

      <input type="text" name="LAT" value="lat" id="my_lat">
      <input type="text" name="LNG" value="lng" id="my_lng">
         </form>



   <!-- Sample addresses //-->
   <p><b>Try these:</b><br />

   <a href="javascript:void(0)"
     onclick="findLocation('1600 amphitheatre mountain view
ca');return false;">1600
     amphitheatre mountain view ca</a><br />

   <a href="javascript:void(0)"
     onclick="findLocation('1 Telegraph Hill Blvd, San Francisco, CA,
USA');return false;">1
     Telegraph Hill Blvd, San Francisco, CA, <b>USA</b></a><br />

   <a href="javascript:void(0)"
     onclick="findLocation('4141 Avenue Pierre-De-Coubertin,
Montr&#x00E9;al, QC, Canada');return false;">4144
     Avenue Pierre-De-Coubertin, Montr&#x00E9;al, <b>Canada</b></
a><br />

   <a href="javascript:void(0)"
     onclick="findLocation('Champ de Mars 75007 Paris, France');return
false;">Champ
     de Mars 75007 Paris, <b>France</b></a><br />

   <a href="javascript:void(0)"
     onclick="findLocation('Piazza del Colosseo, Roma, Italia');return
false;">Piazza
     del Colosseo, Roma, <b>Italia</b></a><br />

   <a href="javascript:void(0)"
     onclick="findLocation('Domkloster 3,  50667 K&#x00F6;ln,
Deutschland');return false;">Domkloster
     3,  50667 K&#x00F6;ln, <b>Deutschland</b></a><br />

   <a href="javascript:void(0)"
     onclick="findLocation('Plaza de la Virgen de los Reyes, 41920,
Sevilla, Espa&#x00F1;a');return false;">Plaza
     de la Virgen de los Reyes, 41920, Sevilla, <b>Espa&#x00F1;a</b></
a><br />

   <a href="javascript:void(0)"
     onclick="findLocation('123 Main St, Googleville');return false;">
     123 Main St, <b>Googleville</b></a>

  </p>
  <div id="mypoint" style="font-size:16pt;line-height:1.1em"></div>

  </body>
</html>
===============================================================
On 22 sep, 21:49, Lance Dyas <[EMAIL PROTECTED]> wrote:
> JulienMARYwrote:
> > On 22 sep, 20:48, Lance Dyas <[EMAIL PROTECTED]> wrote:
>
> >>JulienMARYwrote:
>
> >> you were already told set the values on a hidden form and submit it ...
> >> (yes you can submit a form with javascript look it up.)\
>
> > I'm sorry, I didn't catch it. I'm very beginner with Javascript and
> > The maps API at the same time.
> > For what I have tried at using form submit method, is that my $_POST
> > was seen empty by my script.
>
> > Can you be more explicit please ?
>
>  Its very simple and normal javascript, I request you make an attempt
> then be explicit
>  about posting a link to an active page where you are having problems
> getting it to work so people can debug..
>
> Remember Marcelos comment about
>
> "If you want a more precise answer than that, please follow the posting
> guidelines and post a link to your page."
>
> It still applies, note by not doing so you have wasted a lot of time...
--~--~---------~--~----~------------~-------~--~----~
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