Old 04-03-2009, 07:30   #1 (permalink)
kwills
Senior Member
 
Join Date: Aug 2006
Location: Warrington, UK
Posts: 813
PHP Postcode Search

I am in the middle of a project for a client and they have asked if it is possible for a postcode search facility very similar to the one on this site: Oven Cleaning UK where the user inputs the first half of their postcode and a page will appear with a franchise/store in their given area.

I have been trying to learn PHP for a while now and only really know the basics. I managed to find hopefully something similar to what they are after on this site: HM2K.com » How to search by nearest UK postcode in PHP but am not sure how to implement.

Can anyone shed any light on how to go about this? I have tried to import the Postcode CSV into phpMyAdmin but had no look either.

Cheers
  Reply With Quote
Old 04-03-2009, 07:39   #2 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 6,874
My recomendation is not to build something yourself but use one of the online services that give you a piece of script to insert and charge per search.

Post code DB changes as new streets are built and any download versions are incomplete.

There is one company that does this I am thinking of but can remember URL, I will look it out.
__________________
  Reply With Quote
Old 04-03-2009, 07:40   #3 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 6,874
__________________
  Reply With Quote
Old 04-03-2009, 07:59   #4 (permalink)
kwills
Senior Member
 
Join Date: Aug 2006
Location: Warrington, UK
Posts: 813
cheers for that hound, im not sure if they would like to opt for that though, are there any more roads i could go down? that tutorial seems perfect, im just not 100% sure how to implement it properly.
  Reply With Quote
Old 04-03-2009, 08:12   #5 (permalink)
MikeMackay
Shun the non-believer
 
MikeMackay's Avatar
 
Join Date: Feb 2005
Location: Essex, UK
Posts: 1,866
Send a message via MSN to MikeMackay Send a message via Skype™ to MikeMackay
If you don't need to calculate distance or get the nearest outside of their district then just returning the results of the first 2 letters of the postcode (presuming they're UK postcodes) might be enough. Although this isn't the best way.

Ideally you want to utilise the long/lat coordinates for each postcode of your stores and compare it to the users coordinates. To do that you're going to need to tap in to a service, such as above.

I did something similar recently here:

Lactofree - Stockists

The above uses a custom database that I created and keeps the coordinates locally, which aids speed. The stuff like getting the users coordinates are all done through the Google Maps API.
__________________
  Reply With Quote
Old 04-03-2009, 08:26   #6 (permalink)
kwills
Senior Member
 
Join Date: Aug 2006
Location: Warrington, UK
Posts: 813
cheers mike, like what you did on that site by the way!

I think im going have to look into PHP a bit more and possibly outsource this as it is out of my comfort zone with PHP.
  Reply With Quote
Old 04-03-2009, 08:30   #7 (permalink)
freelancr
Web Developer
 
freelancr's Avatar
 
Join Date: Oct 2006
Posts: 3,967
Postcode anywhere is a piece of piss, just stick in some javascript (that they provide) onto your form and you have the basic bit working, you can improve it by having a failover in PHP incase JS is disabled - but this isn't required.
  Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive
Web Hosting by Heart Internet, vBulletin © 2000-2009 Jelsoft Enterprises Limited.
Search Engine Optimization by vBSEO 3.0.0 RC8
Web Hosting by Heart Internet