there is such a code

<input name="city" type="text" list="city"> <datalist id="city"> <option value="Afghanistan"> <option value="Albania"> <option value="Algeria"> <option value="Andorra"> <option value="Angola"> </datalist> 

Is it possible to stuff all the cities of Ukraine in value? And how can this be done, since there are a lot of them? maybe some kind of php code or js or some service

  • one
    Five hundred cities and it is possible to register why not. - Vladimir Gamalyan
  • 3
    Here is the github.com/leonid-shevtsov/ua-cities/blob/master/ua-cities.xml guy even made the xml ... download to yourself, and paste it through the php script. - Stanislav
  • But the list is far from complete. And some of the cities renamed. So you need to refine it. - KoVadim 2:29 pm
  • and how to get the city on page .php - BedOmar

1 answer 1

 <?php $cities = array('сюда список городов');?> <input name="city" type="text" list="city"> <datalist id="city"> <?php foreach($cities as $city){ echo '<option value="'.$city.'">'; } ?> </datalist> 
  • I guessed it myself, but where can I get the entire list of cities through the "city", "city" - BedOmar
  • I meant how to do that the cities would be through a drunk and in paws in order to shove them into the array - BedOmar
  • 2
    @BedOmar ghm. You go to the Wikipedia page, select all the cities with the mouse, CTRL + C, paste into any editor that knows how regular expressions (for example, notepad ++) and voila - rjhdby