I have two drop down menus on my website. Technologies used are Javascipt , php , mysql.
City : [ ]
Area : [ ]
TODO: When user selects city I want to query database for areas in city and dynamically populate the area drop down menu.
When user selects area I want to query database again for results that belong to that perticular area and city.
Somthing like this(step by step).
------------------------1
City:[Choose City]
------------------------2
City :[New York]
------------------------3
City :[New York]
Area : [Choose Area]
------------------------4
City :[New York]
Area : [Times Square]
------------------------4
10 Results Found for New York/Times Square:
1 . Result1 .
2 . Result2
...
..
.
Here is database schema:
CREATE DATABASE `db_results` ;
CREATE TABLE `tbl_results`(
`result_id` INT NOT NULL AUTO_INCREMENT,
`result_title` VARCHAR(20),
`result_content` TEXT,
`result_category` INT,
`result_city` INT,
`result_area` INT,
PRIMARY KEY(`result_id`),
);
CREATE TABLE `tbl_area`(
`area_id` INT NOT NULL AUTO_INCREMENT,
`area_name` VARCHAR(50),
`area_city` INT,
PRIMARY KEY(`area_id`)
);
CREATE TABLE `tbl_cities`(
`city_id` INT NOT NULL AUTO_INCREMENT,
`city_name` VARCHAR(40),
PRIMARY KEY(`city_id`)
);
I have created script to dynamically flood the menu but when I query database using dynamically generated menu it gives error that 'area' is undefined index.
Here is link to the files: FILES