Jump to content

Generate Google Map from user input


huisjames

Recommended Posts

Hi,

 

How do I generate a Google Map from user registration form?  For example, user enters username, password, and address.  I want to show the username, address + corresponding map on following confirmation page. 

 

I have already used static API to render the map as an image, but this is hard-coded.  I don't know how to pass the address into the address param. 

 

Any help would be much appreciated.  Thanks!

Link to comment
https://forums.phpfreaks.com/topic/220179-generate-google-map-from-user-input/
Share on other sites

are you familiar with forms and getting the user input from the form? if not, here are good google results with tutorials:

 

http://www.google.com/search?client=safari&rls=en&q=php+forms+tutorial&ie=UTF-8&oe=UTF-8

 

Once you are able to get the data from the form, you just need to replace the address in the Google Maps API Javascript with html encoded address data, for instance:

 

// With the google maps Javascript
var address_param = '<?php echo urlencode($address); ?>';

// etc., etc., javascript code

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.