communicating with the database

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
amithn12
Forum Newbie
Posts: 5
Joined: Thu Nov 06, 2003 5:40 am

communicating with the database

Post by amithn12 »

i have 2 combo boxes in html,the first contains the field called categories and the second sub categories. When i select any category from categories i must get the particular subcategories in the subcategory combo box.I have a table for category and a different table for subcategory but i have category id in the sub category.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

You need something like this:
populate categories dropdown from categories table and subcategories dropdown with the subcategories corresponding to default category. Then in onChange event attached to categories dropdown you need to post the form, so it reloads and populates the subcategories dropdown with the subcategories corresponding to selected categories.

Now you have an idea and can start coding.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Moving this to Client Side, as Weirdans suggestion is the prefered one (using Javascript) comparing to the php only-way. (Submitting the form each time for the sub-categories to change).
valen53
Forum Contributor
Posts: 137
Joined: Tue Aug 27, 2002 9:29 am

Post by valen53 »

anyone else can show me about the 2 combo box tutorial ?

i mean use java script onChange(), then select from DB and show value in second combo box.

anyone can show this kind of tutorial ?
Thanks a lot...
Post Reply