Want to add a google maps button to customer address form - php

I'm looking for a way to add a google maps button to a customer contact form that pulls the customers address from MySQL
So basically I want to have a google maps button on the customer contact form that takes the address for that customer stored in MySQL and when the button is pressed it navigates to google maps and displays that customers address.

Try this https://gis.stackexchange.com/questions/52370/how-to-geocode-addresses-from-mysql-and-add-them-like-markers-to-the-google-map I don't think it is exactly what you want but it should get you going in the right direction.

Here's how I did it!
The original question was exactly what I was trying to find out...for hours and hours! Everything I found is for a much more complex implementation.
I just wanted a button that would take the address returned from the database and give the end-user the option to go to Google Maps. Couldn't find the solution anywhere.
Assuming my database has returned values to these fields:
'$loaded_street'
'$loaded_city'
'$loaded_state'
'$loaded_zip'
Go to Map
I did a property search at Google Maps, hit their "Send" button, which launched my email client and included a link to that address.
I took the address out and added the php for each field on my form and it worked!
I'm sure there's a cleaner approach, but I'm not a programmer so I was happy to get it to work since finding such a simple answer was so difficult.
No script, no map API, geocodes, longtitude and lat. Just a link with the right variables.

Here is a scenario for you.
First of all you must know that you will have to use javascript with google maps api.
As Jason suggested you must use geocode.
Geocode is a service of google maps, that gives you the ability to give the api an address, so it can return you something that you can use for the map, like latitude and longtitude.
What you can do is use ajax to request from your server the address, then you use the api as I mentioned and after that is easy. If you don't want to just place a marker, just don't. When you have the location in a way that is useful to your map, you can do whatever you want. From what I understand, you want an infowindow with the address in it.
Some examples that might help you
Geocoding example
Jquery ajax post
How to add an infowindow to your marker
Live example for infowindow
UPDATE
I believe that, if you take the first example and change it a little bit it will do the work. In the example it takes the address from the input. What you will do, is when the user presses the button, then you make an ajax post (or get) to your server and receive the address. When you receive the address you use geocode as the example where you add an infowindow to your marker displaying what you want.

Related

How can I set up email functionality like Craigslist?

I want a button that when pressed brings up a list of possible email providers (similar to the one that can be found on Craigslist). Then a user can choose the email provider that suits their needs and the "To" and "Subject" get automatically populated. I understand that I can set up a link that automatically populates using Outlook, but that isn't what I am looking for. If anyone could point me in the right direction I would really appreciate it.
Here is a Craigslist ad where the functionality can be viewed. Thanks.
First of all you'd need to program a popup dialog box. I'd recommend using jQuery UI's addon dialog for that. Then you'll need to look at the API docs for each email provider and figure out exactly what parameters you need to pass them in a $_GET string to display what you want on their page. All the custom From, To, Subject, etc is handled by the API, unique to each email provider.
Start here for the Google Dev API: https://developers.google.com/google-apps/email-migration/v1/auth

Open google map from my website

I have a list of addresses in database. I can show google from these addresses in my website but I want to make a link from these addresses. When user clicks on address It will open google map in a new tab.
Just done this for a client. If you take the following php generated link:
<?php echo 'http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q='.$placestring.'&aq=&sll=&sspn=&vpsrc=0&ie=UTF8&hq=&hnear='.$near.'&t=h&z=12'; ?>
$placestring in my code is simply the address, put through a htmlentities() routine to ensure it is a safe url. The $near variable can be used to avoid doubt if your addresses are all within a certain area - i.e. if all of the addresses are in London, you could use London as the $near variable. This helps google to provide a better match. If you have postcodes (in the UK) or a lat/long then this will massively help.

PHP Results and Google Maps

Hi I have a database with a list of contacts in which I am displaying onto a page in a list.
As part of this result set I have a post code, is it possible to generate a google map from that postcode and display it as part of the result?
If it is can any one help me get started?
You can use the post code as the location for your map and google will usually be able to find it.
For example, using the static maps API, the following url will give you a map for the zip code 92117 (which is in San Diego, CA):
http://maps.googleapis.com/maps/api/staticmap?center=92117&size=400x400&sensor=false
You can also do something along the lines of what primehunter326 was suggesting and reverse geocode using the javascript API. Which approach is best depends on what you are trying to do.
Start here for info on how to use the various Google Maps APIs:
http://code.google.com/apis/maps/index.html
Yes it is possible. The basic idea is that you use geocode to get longitude and latitude coordinates for the address. You can then use javascript to display a map on your page with all the points as markers. I'll try to find a link with that goes over it in more detail.
Here is a link which goes over geocoding
You'll need an API key in order to use their services, here

Google Maps API Business Search

I have been looking through the documentation for the API and not sure if it is possible to list multiple select stores near the submitted address.
Ultimately something like the following website: http://www.evolutionofsmooth.com/locator/
It seems like they have each location stored in a db but I can't see it that likely since it would be pretty huge to do something like that.
Any ideas?
They probably did store all the shops in a database. They saved the latitude and longitude of each shop. Then they load, via AJAX, all the shops into the google map. Google maps has a tutorial for creating a storelocator.
Google maps api v3 has a function called ClientLocation this can, on base of the IP-address, return the current position of the user viewing the google map. This way the closest shops can be highlighted or put on top of the list.
Hopes this will help!

Google Map with php mysql

my problem is i want to show my registered site user on to google map but dont know how to locate the user, means i dont know the latitude and longitude of every user . I am a newbie in google map so plz help
Thanks a ton
What location data do you have for your users? Cities, states, countries?
You might want to have a look at Google's Geocoding APIs.
there are two possible ways of doing this.
Ask the user to search a google map and place themselves on it. Look here for an idea on how to do this http://www.designing4u.de/2008/08/google-maps-jquery-and-xml-saving-markers-with-user-input/
Use an IP to Location database to find out the location based on their IP. Look here for how to do this http://www.ip2nation.com/ip2nation
There is no way to reliably locate a user using their IP address. However if you are developing for a mobile device it may be possible to acquire their GPS coordinates. Or you could require them to enter an address and place a point on the map from that address with geocoding.
If you are collecting the address of each registered user, you can get the latitude and longitude on the server-side through the Google Maps HTTP Geocoding Service.
You would use the following HTTP request:
http://maps.google.com/maps/geo?q=Oxford+Street,+London&output=csv&sensor=false
Simply change the q parameter with your user's address.

Categories