Forum Moderators: open

Message Too Old, No Replies

Search boxes

programming a searchbox

         

bsingh20

8:05 am on Jun 5, 2005 (gmt 0)



Hi,

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

keyplyr

8:45 am on Jun 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Welcome to Webmasterworld [webmasterworld.com] Bobby.

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.

abbeyvet

9:16 am on Jun 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are various scripts available that will allow you to do this sort of thing.

Do a Google search for 'uk postcodes script' and you will find a number to take a look at.

Matt Probert

12:49 pm on Jun 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Very easy with Perl as a CGI program called by a standard HTML form.

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