Posted By

iloveitaly on 06/04/09


Tagged

php link html google map to from href address directions gmap


Versions (?)

Who likes this?

9 people have marked this snippet as a favorite

fackz
jealousy
vali29
jgipper
BrianCoyDesign
joethermal
ninjacharlee
mecha
ringo380


PHP Create Google Map Directions Link


 / Published in: PHP
 

  1. function googleMapLink($to, $from) {
  2. $destinationAddy = '&daddr='.urlencode($to->getAddress().' '.$to->getCity().' '.$to->getState());
  3.  
  4. if($from) {
  5. $startAddy = '&saddr='.urlencode($from->getAddress().' '.$from->getCity().' '.$from->getState());
  6. } else {
  7. $startAddy = '&saddr=';
  8. }
  9.  
  10. return htmlentities("http://maps.google.com/maps?f=q&hl=en&{$startAddy}{$destinationAddy}");
  11. }

Report this snippet  

You need to login to post a comment.