...

View Full Version : Question regarding dynamic pop-down lists



phpcoder1
11-08-2004, 05:31 PM
Hello,

I have a task to do using PHP, Javascript, HTML and Oracle.

I have two pop-down lists, for the first list the value comes from Oracle database using PHP. Now depending on the value selected in the first list, the second list will have more information about that particular value. For e.g. If my first list has 'USA','INDIA',,'CHINA' as the choices and a user selects 'USA' the second list will give states of USA , if a user selects 'INDIA' the second list will give states of INDIA.

The states will be stored in Oracle. Can someone please tell me how to do this?
Only using Javascript I knw, but thn when the value comes from database in PHP how can I do this?

Any help is highly appreciated.
Thanks,

A1ien51
11-08-2004, 05:53 PM
two choices,

Choice 1: You need to do some sort of post back to the server with the onchange event to populate the second field.

Choice 2: You write out all of the options initially into javascript arrays and you use a double combo script that you can find on http://www.javascriptkit.com

Choice 1 is good if you have 10000's of records. Choice 2 is good if you have a smaller amount of records.

Eric

phpcoder1
11-08-2004, 06:01 PM
thnx for ur reply,

well does this mean that if i need to generate a dynamic list using database and javascript I cannot do that?

Posting the form to itself is not an option for this and so would need some other way to get the records from database and display dynamically using javascript or php-- donno?

Thnx,



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum