Building a Search Feature from a Pre-built list of Locations

This thread and the other thread I just started are probably language-agnostic, but I am building this application in PHP, so I hope I put them in the right forum.

I have a pre-built list of locations containing towns, regions, provinces, country, so it is easy to make the basic search feature to go with this that finds organizations in the database that service the given location. I am using a dropdown for the selection.

But if a user selects a town in the search, I want him to also get results from the region and province that the town is in. Is there any good way of doing this? I thought of having a field in the locations database table that uses the concept of parent and have the search look for parents also. For example, if the town Brookdale is in Province A, then Province A would be listed as Brookdale’s ‘parent’ and the search would pull up all organizations that service Brookdale, and Province A.

Would that work okay, or is there a better way of doing this?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.