Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).
A more accurate (and probably more complex) approach would be to actually store all locations in coordinates. You can use a geolocation webservice (I believe Google provides one, others too) to map location names into coordinates. You can also use IP based geolocation to try to guess where the user is so they won't necessarily have to type their own address.
Ah, I see. Thanks Jani. The only problem with that, I guess, is that a user will have to manually allow me to collect user agent location information - not particularly user friendly and a lot of users would be suspicious of such functionality.
I think your approach can be acceptable depending on the amount of accuracy you require.
I'm not sure how the geolocation API can help me - if the user provides an invalid location that doesn't validate with the API, then a distance measure between the user and the event's location (which will be much better specified with a street address/Google location API 'place') is not possible.
There are formulas (and probably libraries) for calculating distances between coordinates relative to each other, which would make it easy to display things within a certain radius from the user's coordinates and stuff like that.
You can use the geo API to detect the user's location from devices such as the iPhone without them having to manually input (or know) their exact location. Of course it may or may not be useful to you depending on the sort of application you're working on.
You could also consider using the new HTML5 geolocation API which is supported by the latest browsers