Web Analytics Made Easy -
StatCounter populating a select box based on other selections - CodingForum


No announcement yet.

populating a select box based on other selections

  • Filter
  • Time
  • Show
Clear All
new posts

  • populating a select box based on other selections

    I have a form with a select box. Based on the resulting selection in that box I want to populate the next select box... is there any easy way to do this?

  • #2
    without refreshing the page ? no , at least not easy though I think it may be possible with javascript with some jiggery pokery ? , with just PHP alone you would need to refresh the page sending a variable(s) with enough data to populate the select.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


    • #3
      It also depends on where you're getting the data from to populate the box. For example, if you're getting it from a database then you'll need to use PHP (or some other server-side language...). But if yu're going to populate the select box with hard coded data, then Javascript is all you need.

      One approach, though it may not be a great one since people snooping your source will see just about all the data in your database, could be:
      -Query the different possibilities from your database and store each result set in a Javascript array. Then you can use pure Javascript to populate the select box as necessary with the different arrays (hence your data from your database).

      If you need more specific help, just ask.

      Hope that helps,