Forum Moderators: open
I want to put a "find my nearest" type of serch box on my site. Basically I have a list of local groups here in the UK and I want people to be able to tap in a place name in the UK and the search to come up with a list of the nearest groups.
Any ideas of how this can be achieved either within my site or by using a third party search system.
Thanks
Bobby,
London
You don't really "program a searchbox." You build data tables with this info and search them using a search querry language like MySQL installed by your host. The search box can be written in HTML.
The source data can be a simple text file, such as:
<town> <contact name> <phone number>
all separated by a single delimiter, perhaps a tab, and the records terminated by a newline character.
Then you can read with Perl and use a regexp or simpler 'eq' to locate a match, eg:
$file = "data.txt";
open(FILE, $file);
while (<FILE>)
{
@data=split('\t',$_);
if ($location_to_find eq $data[0])
{
# Matching location found
}
}
Sticky me if you want some more help. I'm based in the UK also.
Matt