1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Help PLEASE working on this for a day now..

Discussion in 'C#' started by parad0x, Mar 15, 2006.

  1. #1
    I need to make a dropdown menu which takes data from 2 tables of the same database. Lets say we have table a and table b. a has id,name,type and b has name,description. When something is chosen from dropdown menu which uses table a, i want the second dropdown menu which uses table b to change according to the first dropdown menu. (select b.name,a.name from a,b where a.name=b.name) That is all i need then i guess i can edit the code for other needs. Would be great if some1 can help me with this.
     
    parad0x, Mar 15, 2006 IP
  2. Rooster

    Rooster Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    http://www.frontpagehowto.com/dynamicdrop/default.asp
    http://www.spiderwebwoman.com/tutorials/doubledropdown.htm"]
    might help you if u'r using FP
     
    Rooster, Mar 15, 2006 IP
  3. eiso

    eiso Peon

    Messages:
    583
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Look at MySQL JOIN for the mysql query part
     
    eiso, Mar 15, 2006 IP
  4. mopacfan

    mopacfan Peon

    Messages:
    3,273
    Likes Received:
    164
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The thing is, unless you're employing javascript as well as pulling all possibilities down on the first pass, you will have to refresh the page to make this work. Do you mind refreshing the page?
     
    mopacfan, Mar 15, 2006 IP
  5. jaymcc

    jaymcc Peon

    Messages:
    139
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    AJAX is another option so you don't have to page refresh. I recently did the tutorial a w3schools.

    http://www.w3schools.com/ajax/default.asp

    mopacfan is right... you'll need to use javascript to create the best user experience.
     
    jaymcc, Mar 18, 2006 IP
  6. fluid

    fluid Active Member

    Messages:
    679
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    70
    #6
    Like everybody else has said, javascript is the way forward unless you want to refresh the page. But it's gonna put your programming skills to test :)

    Say for example, you have 5 departments (A, B, C, D and E) and you have the names of the people who work in there as (a1, a2, a3 ...), (b1, b2, b3 ...)

    If somebody chose department B, (b1, b2, b3 ...) will be displayed, right?

    To do this you will have to create a series of arrays:

    departments_Arr[] will contain all the different departments referencing their ids as follows:

    departments_Arr[1], departments_Arr[2], departments_Arr[3] ...

    now departments_Arr[1] will become yet another array storing all the names of the people for department A having id 1.

    Therefore when people select a particular department from your dropdown, you just have to pass the appropriate id to fetch the required department array which will trigger a refresh function to show the relevant names.

    If you're still unclear, ask me to explain.
     
    fluid, Mar 23, 2006 IP
  7. parad0x

    parad0x Active Member

    Messages:
    510
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    70
    #7
    I did it with a little javascript and asp.(Was real hard for me because i always use PHP and they asked me to id with ASP but i made it.. If anyone needs the source codes for it i may give you. Thanks for help every1.
     
    parad0x, Mar 28, 2006 IP