Search code examples
phpjqueryhtmljquery-validategoogle-geocoding-api

Variables defined in <?php to be included with form when submitted


I have a form that the user fills out the company information. I then use jquery to validate the addresses and within the submitHandler I have the following script to get the long/lat of the validated address, but the long/lat is not being submitted with the form. (I currently have the address for long/lat lookup hard coded in the link for testing purpose.) Also note, you will need to provide your own API key for Google Maps API v3 which you can get HERE.

NOTE: I am having difficulty with Stack Overflow's syntax highlighter so linking the code from PastBin.

This is the script for the long/lat


Because of limitation on number of links I could post, I will post links to the rest of my code hopefully after this post.


Solution

  • Add two hidden inputs into the form for the lat and lng, then when the geocoding completes fill in the values of those inputs.