Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2004
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question regarding dynamic pop-down lists

    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,

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    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
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New to the CF scene
    Join Date
    Nov 2004
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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,


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •