Reputation: 97
Hey there im trying to use google maps iframe to show a map with the direction between 2 locations in my site. The problem with this is that i constantly need to reload the page with different addresses and i am unable to simply replace the iframe's cities in order to bring up new results.
Heres the code for the iframe
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.uk/maps?f=d&source=s_d&saddr=london&daddr=Leeds,+UK&hl=en&geocode=FaHzEQMd-wv-_yl13iGvC6DYRzGZKtXdWjqWUg%3BFT_xNAMd6V7o_ymZvWTaSj55SDGp3BMC_bqtUQ&aq=1&oq=l&sll=53.800651,-4.064941&sspn=22.225372,67.631836&mra=ls&ie=UTF8&t=m&ll=52.654755,-0.848175&spn=2.29307,1.44201&output=embed"></iframe><br /><small>
What i was trying to do is simply replace the city names through php(e.g. london with <?php $firstTown ?>
) but no luck in updating the result as it appears to be using the old coordinates.
How would i go on about viewing a map with php variable cities on every page load?
Thanks for your help
Upvotes: 0
Views: 6900
Reputation: 1509
<?
if ($partner->post_adres)
{
$map_url = $partner->post_adres.','.$partner->post_postcode.','.$partner->post_city;
$map_url = str_replace(" ", "+", $map_url);
?>
<iframe width="350" height="250" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.nl/maps?q=<?=$map_url?>&hl=nl&ie=UTF8&t=v&hnear=<?=$map_url?>&z=13&output=embed"></iframe>
<?php
}
Works for me
Upvotes: 2