Click here to Skip to main content
15,884,605 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to display google maps for current addresses, but unfortunately only a world map appears on the site.

The code:

<iframe src="https://www.google.com/maps?q=<?php echo $data['post'] . ' ' . $data['city'] . ' ' . $data['street'] . ' ' . $data['number']; ?>&output=embed"></iframe>


What I have tried:

Looks like this in browser:

<iframe src="https://www.google.com/maps?q=1111 Cityname Street name 1&output=embed"></iframe>

What might be the problem?
Posted
Updated 8-Mar-23 21:45pm

1 solution

If I feed it a valid address (such as my current location or Buckingham Palace) in place of your filler, it works with the iframe:
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  </head>
  <body>
        <iframe src="https://www.google.com/maps?q=Buckingham Palace, London&output=embed"></iframe>
  </body>
</html>
So start by checking your location is spelled correctly and describes an actual address.
 
Share this answer
 
Comments
István Balogh 9-Mar-23 3:48am    
The name of the street got changed, but they didn't update it on google maps, so it couldn't find the address, Thank you for your time!!
OriginalGriff 9-Mar-23 4:25am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900