Sorry for posting whole code. I wont do that again.
I gave it to be csv because If i make it be jason, then it isnt sending any data to the $data and it outputs an error message.

    In that case; if you're asking for the results to be in CSV format, why are you trying to json-decode it?

    If it generates an error message when you request a JSON-encoded response, what does the error message say?

    And again:
    Since [font=monospace]$geo_json[/font] gets its value from [font=monospace]$data[/font], what does [font=monospace]$data[/font] contain (now that you've changed the response format to CSV)?

      $data has lat and long values of the specified address...

      yes i got the map to display and it gives me pop up info window...and not the lat long values..but i know for that i shd create amarker and assign it to the user input ...how do i do that?
      do i have to use onclick() in yet another js file or ...how pls help
      am a total noob

      heres the code
      <?

      $gkey = "AIzaSyCrfnKng8Dk_PW0Q6D5n2ftNp_zrirBFDs";
      $addr = "West sussex London England";
      $address = urlencode($addr);

      $url = "http://maps.google.com/maps/geo?q=".$address."&output=json&key=".$gkey;
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_HEADER,0);
      curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      $data = curl_exec($ch);
      curl_close($ch);

      $geo_json = json_decode($data, true);

      / echo $geo_json; /

      if ($geo_json['Status']['code'] == '200')

      {

      $latitude = $geo_json['Placemark'][0]['Point']['coordinates'][0];
      $longitude = $geo_json['Placemark'][0]['Point']['coordinates'][1]; 

      ?>
      <iframe width="425" height="350" frameborder="1" scrolling="yes" marginheight="0" marginwidth="0"
      src="https://maps.google.co.uk/maps?q=map&amp;oe=utf-8&amp;aq=t&amp;client=firefox-a&amp;ie=UTF8&amp;hl=en&amp;hq=map&amp;hnear=&amp;t=m&amp;ll=<?php echo $longitude; ?>,<?php echo $latitude; ?>&amp;output=embed"></iframe>

      <?php
      
      } else { echo "<p>No Address Available</p>";}

      ?>

        $data has lat and long values of the specified address...

        yes i got the map to display and it gives me pop up info window...and not the lat long values..but i know for that i shd create amarker and assign it to the user input ...how do i do that?
        do i have to use onclick() in yet another js file or ...how pls help
        am a total noob

        heres the code
        <?

        $gkey = "AIzaSyCrfnKng8Dk_PW0Q6D5n2ftNp_zrirBFDs";
        $addr = "West sussex London England";
        $address = urlencode($addr);

        $url = "http://maps.google.com/maps/geo?q=".$address."&output=json&key=".$gkey;
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER,0);
        curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $data = curl_exec($ch);
        curl_close($ch);

        $geo_json = json_decode($data, true);

        / echo $geo_json; /

        if ($geo_json['Status']['code'] == '200')

        {

        $latitude = $geo_json['Placemark'][0]['Point']['coordinates'][0];
        $longitude = $geo_json['Placemark'][0]['Point']['coordinates'][1]; 

        ?>
        <iframe width="425" height="350" frameborder="1" scrolling="yes" marginheight="0" marginwidth="0"
        src="https://maps.google.co.uk/maps?q=map&amp;oe=utf-8&amp;aq=t&amp;client=firefox-a&amp;ie=UTF8&amp;hl=en&amp;hq=map&amp;hnear=&amp;t=m&amp;ll=<?php echo $longitude; ?>,<?php echo $latitude; ?>&amp;output=embed"></iframe>

        <?php
        
        } else { echo "<p>No Address Available</p>";}

        ?>

          Katie, as Weedpacket has mentioned, please wrap your code in [noparse]

            

          [/noparse] tags --- this will not only help keep the page length down (by adding scrollbars to your code snippets), it will also show some PHP errors due to the use of PHP Syntax Highlighting in quoted PHP code.

          Just curious ... when the IFRAME is created, what does the SRC tag say? Is "ll=" empty?

          Just a tip, you could easily combine those two echo() statements, like this:

          <iframe width="425" height="350" frameborder="1" scrolling="yes" marginheight="0" marginwidth="0" 
          src="https://maps.google.co.uk/maps?q=map&amp;oe=utf-8&amp;aq=t&amp;client=firefox-a&amp;ie=UTF8&amp;hl=en&amp;hq=map&amp;hnear=&amp;t=m&amp;ll=<?php echo "$longitude,$latitude"; ?>&amp;output=embed"></iframe>

          (Technically, there are several different ways you could combine that ... making it easier to read and more "elegant". 🙂

            Many thanks...I am very new to programming, just started learning php, and am very new to this forum. I will take on your advice and will do that.

            but how to take user input as a click and store it in a var and pass it on to php file as a marker and then make gmap display out the info window with lat and lon of that specified spot?

            any help is much appreciated..

              katiephp wrote:

              any help is much appreciated..

              Well ...

              dalecosp wrote:

              Just curious ... when the IFRAME is created, what does the SRC tag say? Is "ll=" empty?

                I copied the google map link code and pasted it into my code

                  To answer dalecosp's question, load up the page, choose "View Source", find the <iframe> tag, and copy the value of its src attribute. That's what's being asked for.

                    katiephp;11009887 wrote:

                    yes thanks for clarifying but that is what it shows
                    <iframe width="425" height="350" frameborder="1" scrolling="yes" marginheight="0" marginwidth="0"
                    src="https://maps.google.co.uk/maps?q=map&oe=utf-8&aq=t&client=firefox-a&ie=UTF8&hl=en&hq=map&hnear=&t=m&ll=<?php echo "$longitude,$latitude"; ?>&output=embed"></iframe>

                    If that is exactly what is showing in your browser "view source", then PHP is not being parsed properly. The browser should never see anything like "<?php echo $foo; ?>" ... the server is supposed to turn that into actual numbers before it's sent to the browser.

                    I would talk to your server administrator or your hosting service. Something is not configured properly, and they would be in the best position to help you out.

                      katiephp;11009899 wrote:

                      yes i sorted it out heres the code

                      <iframe width="425" height="350" frameborder="1" scrolling="yes" marginheight="0" marginwidth="0"
                      src="https://maps.google.co.uk/maps?q=map&amp;oe=utf-8&amp;aq=t&amp;client=firefox-a&amp;ie=UTF8&amp;hl=en&amp;hq=map&amp;hnear=&amp;t=m&amp;ll=51.4943765,-0.1603387&amp;output=embed"></iframe>

                      Well, if you take out the "amp;" s and put this in a browser, I get a map of London, north of King's Road. Are you sure you need the ampersand encoded in your IFRAME tag?

                        i copied it and pasted into my php code from google map code..

                        so i havent altered it in anyway and still it works..

                          dalecosp;11009903 wrote:

                          Are you sure you need the ampersand encoded in your IFRAME tag?

                          Yes, unless you want to violate W3C's HTML standards.

                            dalecosp;11009903 wrote:

                            Well, if you take out the "amp;" s and put this in a browser, I get a map of London, north of King's Road. Are you sure you need the ampersand encoded in your IFRAME tag?

                            Entering the URL straight into the address bar bypasses any (need for) HTML escaping.

                              True, which was the first part of my statement.

                              I'm curious at that though ... you would need it in your HTML to be compliant, I guess. It would be rather weird if Google's map API didn't interpret that properly. So, grasping at straws. But I've seen some strange things whilst attempting to debug client-side issues ... stuff that would make the old, pure PHP me really scratch his head 😃

                              I suppose we can assume that "katiephp" has this working now?

                                5 days later
                                dalecosp;11010163 wrote:

                                I'm curious at that though ... you would need it in your HTML to be compliant, I guess. It would be rather weird if Google's map API didn't interpret that properly.

                                Not really. And if you take the time to look at what happens, it's relly not strange at all

                                If you send character entities for ampersand to the browser, as you should

                                printf('<iframe src="%s">',
                                    'http://example.com/script.php?a=1&amp;b=2'
                                );
                                

                                The browser will convert the ampersand entities into ampersands, like it is supposed to, giving

                                <iframe src="http://example.com/script.php?a=1&b=2">
                                

                                which would give google an array of GET values, where a => 1 and b => 2

                                However, if you have created entities twice in an url orginally without them

                                From
                                'a=1&b=2'
                                To
                                'a=1&amp;b=2'
                                
                                And finally to (what you then send)
                                'a=1&amp;amp;b=2'
                                

                                Since that is converted by the browser into

                                a=1&amp;b=2
                                

                                you get the same thing as if you had pasted exactly that into the address bar of the browser, which would give you a GET array of two values

                                a => 1
                                amp;b => 2
                                

                                However, if you incorrectly do not translate & into its character entity ref &amp; then you send

                                'a=1&b=2'
                                

                                to the browser, which will discover that
                                1. there is no character entity reference

                                &b=2
                                

                                2. the character entity reference is missing its ;

                                And since the browser doesn't know what to do with the screwed up char ref, it leaves things as they are, i.e.

                                a=1&b=2
                                

                                which means you do get the correct value for your url while not fowlloing the standard.

                                  Write a Reply...