I'm building a web application that requires users to provide their location (similar to the way Facebook does it). I'm not sure on the best way to implement this. I require the ability to search through records of another entity (call it 'events') which also have a physical location attached to it, and match the users in the same or close enough location. I only require resolution to individual cities/towns.
The way I allow the user to provide his/her location (including validation and how free-form I would allow this input), the way to store this field in the DB, etc. obviously depend on each other. My current thinking is to allow free-form entry, store as a text string, and match by breaking up the location string into an array (delimited by commas and period characters), then comparing the user location array to the event location array.
Is there any way that I can make the problem easier on myself by validating against a list of locations provided by a web service somewhere? How is this problems usually handled?
Any help would be greatly appreciated!