PHP Classes
elePHPant
Icontem

Cities and zip codes: Lookup for cities and zip codes using AJAX

Recommend this page to a friend!
  Info   View files View files (31)   DownloadInstall with Composer Download .zip   Reputation   Support forum (4)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2006-10-17 (10 years ago) RSS 2.0 feedStarStarStarStar 67%Total: 5,410 All time: 438 This week: 1,042Down
Version License Categories
ocities 1.0.0Free for non-comm...Geography, AJAX
Description Author

This package can be used to lookup for cities and the respective zip codes.

It uses AJAX to search a file database with cities and the respective zip codes using just the first few letters of the city that the user types in a form text input.

The class can submit an AJAX request to find the cities that match the typed letters and display the city names without reloading the whole page.

It can also search for zip codes if the user types the first numbers of the zip code to search.

The listing that is displayed may be sorted by city name or zip code.

The example uses a file database with French cities but it may be replaced by another file with city and zip code information of anywhere in the world.

ADDITION : I put 2 versions :
'villes_normal/' folder is the old version
'villes/' folder is the new version, with Phonex and Soundex searches and sorting added

Picture of Johan Barbier
Name: Johan Barbier <contact>
Classes: 17 packages by
Country: France France
Innovation award
Innovation award
Nominee: 6x

Details
[PHP5] && [PHP4]
This script is used to look for cities and zip codes, via xmlhttp request.

It is very simple :
If you input letters, the script will look for all the cities  and their zip code 
with a name beginning by these letters, and display them. Same stuff if you input 
numbers : the script will look for cities whose zip code begins with these numbers.

You can sort the list displayed, ordering them by the names, or the zip codes.

A joker is available : *
Use it to display ALL the cities (beware, it can take a loooong time...there are currently 
40000 cities in the data file).

Currently, the data file only contains all the French cities.
You can change the data file when you call the constructor of the 'ocity' class.
Data must be formatted that way :

city \tab||several_spaces zip_code\endline
city \tab||several_spaces zip_code\endline
city \tab||several_spaces zip_code\endline
...and so on
  Files folder image Files  
File Role Description
Files folder imagecss (1 file)
Files folder imagedocs (1 directory)
Files folder imagevilles (2 files, 2 directories)
Files folder imagevilles_normal (1 file, 2 directories)
Accessible without login Plain text file readme.txt Doc. Readme file

Downloadocities-2006-10-17.zip 124KB
Downloadocities-2006-10-17.tar.gz 102KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
Soundex 2 Download .zip .tar.gz To use the new search features Conditional
 Version Control Unique User Downloads Download Rankings  
 0%
Total:5,410
This week:0
All time:438
This week:1,042Down
User Ratings User Comments (1)
 All time
Utility:83%StarStarStarStarStar
Consistency:87%StarStarStarStarStar
Documentation:87%StarStarStarStarStar
Examples:87%StarStarStarStarStar
Tests:-
Videos:-
Overall:67%StarStarStarStar
Rank:491
 
Awesome I like very much :)
8 years ago (Nino Paolo Amarillento)
80%StarStarStarStarStar