Is there away to embed google maps with inputted search?

后端 未结 2 2037
北恋
北恋 2021-01-26 13:29

I\'m trying to make so when a user selects a country in a form and clicks submit, it redirects them to a page that has an embedded google maps widget that also is showing the co

相关标签:
2条回答
  • 2021-01-26 13:43

    q is the parameter you use for address

    <iframe 
            src="https://www.google.com/maps?z=4&f=q&output=embed&q=<?=$country?>">
    </iframe>
    
    0 讨论(0)
  • 2021-01-26 13:46

    you have to get a Google API key which is free then what your doing would work.

    <?php
    $country = "United States";
    ?>
    
    <div id="map">
    <iframe
      width="600"
      height="450"
      frameborder="0" style="border:0"
      src="https://www.google.com/maps/embed/v1/place?key={YOUR KEY HERE}&q=<?=$country?>" allowfullscreen>
    </iframe>
    </div>
    
    0 讨论(0)
提交回复
热议问题