Web script help

Post Reply
Whataday
Posts: 361
Joined: Fri 22 Aug, 2003 00.08
Location: Cardiff
Contact:

I might have to go to a more specialist forum but thought I'd give it a shot here.

Without giving too much away, I'm in the process of developing an online business, and whilst I've created the concept and design, I'm struggling with some of the more technical aspects.

I want a webuser to log onto my site, enter their postcode, and select what type of business they are looking for. Then, a list of the specific businesses within a 20 mile radius appear, with a link to another page providing more information on that business.

I know the postcode is the more ambitious part, so I'm willing to drop that in favour of "town or area" being as I am working within a small region at the moment.

Does anyone have any help or info on how this could be done?
User avatar
Sput
Posts: 7543
Joined: Wed 20 Aug, 2003 19.57

The postcode database (assuming you have a copy, which you will need really) might be able to help you.

Something that does the following would probably do it...
You have your list of businesses in a database server, each with its postcode.

Then when the user enters their postcode
- Split the first half of the given postcode into its constituent letter(s) and number(s)

- I think probably ignoring the first letter(s) unless they have a very big distance selected, because it deals with entire cities, is a good plan.

- Get the script to vary the numerical part by a set amount up and down, depending on how far they want to search.

- It could then check against the database to see if any places have a postcode within this interval.

For example, you live in Manchester M14 - and you want to search for places pretty damn close, you could get the script to search for places with postcodes starting M13 to M15.

The problem is deciding how far a distance is necessary to make the postcode change by one digit.

----

The town/city area is an easier version, it could just match the user's request with a identical/similar entry in your database.

-----

I use MySQL and PHP for this kind of thing.

Good luck!
Knight knight
Whataday
Posts: 361
Joined: Fri 22 Aug, 2003 00.08
Location: Cardiff
Contact:

Thanks for your help. Do you have any more advice on how i would do the town/city version?
Post Reply