title: Get the place_id of a city using google places autocomplete
body: <p>I'm using an input field with google places autocomplete. I' ve set autocomplete to predict only cities but I'm stuggling to find a simple way to get the unique place_id of the selected city. I don't want to use it with google maps. I need it just to identify with a unique value the selected city.. Thanks in advance..</p>
  
  <p>Here's my JS:</p>
  
  <pre><code>&lt;script src="maps.googleapis.com/maps/api/js?libraries=places"; type="text/javascript"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  function initialize() { 
    var options = { types: ['(cities)'] };
    var input = document.getElementById('searchCity');
    var autocomplete = new google.maps.places.Autocomplete(input,options);
  }
  google.maps.event.addDomListener(window, 'load', initialize);
  &lt;/script&gt;
  </code></pre>
  
  <p>And here's my PHP:</p>
  
  <pre><code>&lt;form method="GET" action=&lt;?php echo $_SERVER['PHP_SELF'];?&gt;&gt;
  &lt;input id="searchCity" type="text" size="50" 
    placeholder="Enter a City" autocomplete="on" name="city"&gt;
  &lt;br&gt;
  &lt;?php if (!empty($_GET['city']) ) {
    echo $_GET['city'];
  } else {
    echo "not set";
  }
  unset($_GET['city']); ?&gt;
  &lt;/form&gt;
  &lt;!-- Here I would like to show the place_id of the selected city--&gt;
  &lt;/div&gt;
  </code></pre>