PDA

View Full Version : [php mysql] access city locations across an entire country



swapnet
March 29th, 2008, 01:24 PM
Hi,

I have a mysql table for most of the places and cities of my country for the website I am doing for a real estate company and we're using one "locations" table to
a) locate a real estate property
b) locate the user's contact address

Their immidiate Street Address and post code is stored in the users table and the rest should be extracted from the locations table using an area id (something like say LH18).

This is what my table looks like >

locID, areaname, city, district, zone, state

and when a user signs up, I want them to first select their state, and maybe by refreshing page or using ajax grab only the zones in that state from the db, and so with districts, city...

someone please help!

kdd
March 30th, 2008, 01:38 PM
You "must" use ajax for better usability, unless javascript is turned off, then you have to use some other method.

On select of the state, send a POST request to a PHP file that will "SELECT DISTINCT something FROM someTbl WHERE city='$cityProvidedByTheUserWhichIGotUsingPHPPost'" and return it.

Not sure if it'll help much, but it'll at least get you started. :)
(Yup, I like long variable names. :pleased:)