Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Forms: Select options, filtered by another select option

Guest
Dec 15, 2009 Dec 15, 2009

Hey chaps, hope someone can help with this:

I have a PHP form, with a couple of Select menus, which are populated from two SQL tables:

// Select 1 (main colour):

  1. Red
  2. Blue
  3. Green

// Select 2 (shade colour):

  1. Light Red
  2. Dark Red
  3. Light Blue
  4. Dark Blue
  5. Light Green
  6. Dark Green

What I'm after is something to filter the second select option, after the first select option has been chosen

// Select 1:

  1. Red

// Select 2:

  1. Light Red
  2. Dark Red

I'm pretty sure this is possible, but not sure how to go about it, any help would be most appreciated.

TOPICS
Server side applications
384
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Dec 16, 2009 Dec 16, 2009

What you're referring to are called cascading drop-down menus. You either need to store all the values for the second menu in a JavaScript array, or use Ajax to query the database again, based on the first selection. Do a Google search to find further information.

Translate
LEGEND ,
Dec 16, 2009 Dec 16, 2009
LATEST

What you're referring to are called cascading drop-down menus. You either need to store all the values for the second menu in a JavaScript array, or use Ajax to query the database again, based on the first selection. Do a Google search to find further information.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines