title: Auto fill state and country by name of city in google map api from php
body: <p>I have implemented Google map API on search. 
  My code is working properly till auto generated location but I want such facility by which I can get exact location by providing only city name not whole format string.</p>
  
  <p><strong>For ex:</strong></p>
  
  <p>Please check this image <a href="http://demo.ncryptedprojects.com/nct_bnb_clone_new/Untitled.png" rel="nofollow noreferrer">http://demo.ncryptedprojects.com/nct_bnb_clone_new/Untitled.png</a></p>
  
  <p>I'm entering city name Mumbai in search box and Google map API retrieves all values in drop-down. When someone does not choose any value from drop down and directly presses enter after city name I cant get exact search for city Mumbai in map.
  What I exactly want to do is, when someone enters city name and then search it should automatically search first occurrence from drop-down like "Mumbai Maharashtra,India"</p>
  
  <p><strong>HTML form</strong></p>
  
  <pre><code>&lt;input name="location" id="location" type="text"/&gt;
  </code></pre>
  
  <p><strong>Google map API</strong></p>
  
  <pre><code>&lt;script src="https://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places"&gt;&lt;/script&gt;
  
  $(function() {
              var e;
              e = $('.search-form input[name="location"]')[0];
              return new google.maps.places.Autocomplete(e, {
                  types: ["geocode"]
              })
  
      });
  </code></pre>