Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9152499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:03:47+00:00 2026-06-17T12:03:47+00:00

See below sample of simple google map set to Lat and Long. This code

  • 0

See below sample of simple google map set to Lat and Long.
This code would work for the purpose, but need php echo of City, State chosen by user to display in lieu of Lat Long. Can anyone outline the code to make this execute?
Want to be compatible with Google Maps API v3. Greatly appreciate.

<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
      html { height: 100% }
      body { height: 100%; margin: 0; padding: 0 }
      #map_canvas { height: 100% }
    </style>
    <script type="text/javascript"

      src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&sensor=SET_TO_TRUE_OR_FALSE">
    </script>

    <script type="text/javascript">
      function initialize() {
        var mapOptions = {
          center: new google.maps.LatLng(-34.397, 150.644),
          zoom: 8,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var map = new google.maps.Map(document.getElementById("map_canvas"),
            mapOptions);
      }
    </script>

  </head>
  <body onload="initialize()">
    <div id="map_canvas" style="width:100%; height:100%"></div>
  </body>
</html>

In past, i’ve used the following code to display City, State:

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=BQIAAAAmGS6pKWpRUcdw4oR9pzpvBQzjcAJnzRmzqULnEw6fdi4mPoYnxR1kxeM4lTW9o75OG9vfiUP8DKkig" type="text/javascript"></script>    
    <script type="text/javascript">
    var map = null;
    var geocoder = null;
    function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        map.setMapType(G_HYBRID_MAP);
        disableDefaultUI: true;
        map.enableScrollWheelZoom();
        geocoder = new GClientGeocoder();
      }
        showAddress("<?php echo $_SESSION['city_name']; ?>");
    }
    function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
            //alert(address + " not found");
            } else {
            map.setCenter(point, 13);
            map.setZoom(13);
            }
          }
        );
      }
    }
</script>

</head>

<body onload="initialize()" onunload="GUnload()">
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:03:49+00:00Added an answer on June 17, 2026 at 12:03 pm

    Code was copied from geocode-with-google-maps-api-v3 and reorganized so it should look like your old code.

    <html>
    <head>
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
        <style type="text/css">
            html { height: 100% }
            body { height: 100%; margin: 0; padding: 0 }
            #map_canvas { height: 100% }
        </style>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
        <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY&sensor=false"></script>
        <script type="text/javascript">
            var geocoder;
            var map;
            var marker;
    
            function initialize() {
                var latlng = new google.maps.LatLng(-34.397, 150.644);
                var mapOptions = {
                    zoom: 8,
                    center: latlng,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                };
                map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
                geocoder = new google.maps.Geocoder();
                marker = new google.maps.Marker({
                    map: map,
                    draggable: true
                });
    
                showAddress('Ljubljana');
            }
    
            function showAddress(address) {
                geocoder.geocode({'address': address}, function(results, status) {
                    if (status != google.maps.GeocoderStatus.OK) {
                        return;
                    }
                    if (results.length > 1) {
                        alert('Multiple addresses found; showing first one ...');
                    }
                    $.each(results, function(i, item) {
                        var location = new google.maps.LatLng(item.geometry.location.lat(), item.geometry.location.lng());
                        marker.setPosition(location);
                        map.setCenter(location);
                        return false;
                    });
                });
            }
        </script>
    </head>
    <body onload="initialize()">
        <div id="map_canvas" style="width:100%; height:100%"></div>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple but subtle question. Below you see two different declaration variants
I have a google map to embed using the simple iframe code. my problem
Below is the notepad sample code, why the android:authorities = com.google.provider.NotePad instead of using
I have a simple .dot file (graphviz), see below: digraph Mapper{ Mapper [label=Mapper]; General
I am using the .Net XslCompiledTranform to run some simple XSLT (see below for
FOUND THE ANSWER MYSELF, see below... I'd like to have a very simple user
Please see the sample xml given below. As per a requirement, I need to
Please see below code: thrust::device_vector<int>::iterator whereToBegin = copyListOfNgramCounteachdoc.begin(); end = thrust::unique_by_key(end.first, end.first + numUniqueNgrams,end.second);
Please see below: I tried using Absolute layout, but that's deprecated. I appreciate your
I defined such simple class as below: >>> class myclass(object): name = google And

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.