On selection, change contents of combo box

Discussion in 'PHP' started by lost, Oct 31, 2005.

  1. #1
    I have 2 combo boxes, one for category and one for type.
    On start the category combo box includes a list of all categories, i.e. books, video, music, dvd. the type combo box includes nothing.
    Once a category form the combo box has been selected, the type combo box gets populated with the specific types for that category.

    Anyone know how to do this???
     
    lost, Oct 31, 2005 IP
  2. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #2
    When you say combo box do you mean the select option form list?

    If so then yes I know how to do this.
     
    Weirfire, Oct 31, 2005 IP
  3. TheHoff

    TheHoff Peon

    Messages:
    1,530
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    0
    #3
    TheHoff, Oct 31, 2005 IP
  4. lost

    lost Peon

    Messages:
    144
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    yes that is what i mean, can you help me?
     
    lost, Oct 31, 2005 IP
  5. lost

    lost Peon

    Messages:
    144
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks vbMechanic...thats exactly what i need :)
     
    lost, Oct 31, 2005 IP
  6. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #6
    Thats almost exactly what I had as well.

    You could use some css to hide the list that doesnt have anything until the first list has been selected :)
     
    Weirfire, Oct 31, 2005 IP
  7. lost

    lost Peon

    Messages:
    144
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    what's css??
     
    lost, Oct 31, 2005 IP
  8. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #8
    Weirfire, Oct 31, 2005 IP
  9. mnemtsas

    mnemtsas Super Dud

    Messages:
    497
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I do this in several spots. You need to build up a js array for each selection list. Then on the onclick event of the first box you fill the contents of the second box with appropriate js array. When I get to work I'll post the js I construct from php and the code I use to construct it.
     
    mnemtsas, Oct 31, 2005 IP
  10. sarahk

    sarahk iTamer Staff

    Messages:
    28,840
    Likes Received:
    4,542
    Best Answers:
    123
    Trophy Points:
    665
    #10
    If you need to query the database to get the results for the first list a technique like I use here may be useful but these days people use AJAX.
     
    sarahk, Nov 1, 2005 IP