Development – Google Maps

PHP Dynamic Google Map

Instructions:

In the code below, set the $address variable to the address of your choice. Example: 1625 Hennepin Ave, Minneapolis, MN.

Your PHP Code:


$address = '1625 Hennepin Ave, Minneapolis, MN';
    
echo '<iframe frameborder="0" src="https://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=' . str_replace(",", "", str_replace(" ", "+", $address)) . '&z=14&output=embed"></iframe>';

Output:


<iframe frameborder="0" src="https://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=1625+hennepin+ave+minneapolis+mn&z=14&output=embed"></iframe>

Renders: