View Full Version : How do I implement a look up table ?
03-25-2005, 07:01 PM
I have a website devoted to driving holidays in the USA. I have coded the site by hand in notepad as I wanted to learn HTML.
I would like to introduce a feature where a site user selects a starting city from a drop down menu and a destination city from another drop down. The web page then gives the distance and driving time between the two.
Where do I start ? I could do this in basic with and array of data but I dont know where to start in HTML or java and I have not been able to find out by searching the web. --- Help !!
03-29-2005, 09:31 AM
So if it's a large scale operation with lots of potential permutations / outcomes, you're best using ASP or PHP to programatically populate your select dropdown options.
04-03-2005, 06:27 PM
mmmm, well as far as populating the dropdown menus your better off with a server side language like php. Here you could have a comma seperated file with all the cities you list that are read in to populate the drop down boxes. Or if you have it a database connection to extract the values. Or just hand code them all into the drop down boxes.
As far as calculating the distance between the two cities. Your going to need an external service provider for this. I dont think there are any free ones out there. But, you could link your form to an external site like the RAC route planner with the values. Im mummbling on a little here, ill show you what i mean in next post.
04-03-2005, 06:38 PM
Ok look at www.map24.com they have a free link2 service whereby you can pass the start and destination information for the two cities and they will display a map and the distance and time.
This will take away from your site though so you might want to pass the values to one of your pages and open map24 through a pop-up window. Have a look anyway its free to register.
04-04-2005, 05:30 AM
Excellent find Chris! I've been playing with the UK version (http://www.uk.map24.com/) of the site and I'm really impressed!
Pity it relies so heavily on the Java platform, but saying that, the functionality more than makes up for this!
04-05-2005, 08:23 AM
Many thanks for everybody for taking the time to reply.
I have lifted bits from various scripts and come up with my version of what I wanted to do. Its at
Its a nightmare to create something like this in terms of formatting the data and I'm sure the code is poor quality but the end result is just about what I was after.
The mention of having comma separated variables and extracting them sounds very attractive. Where do I find out about php ?