Changing dropdown options with php

software development

#1

I have two dropdown menus on a page. I was wondering how I could change the second menu’s list based on the first selection. I’d prefer not to use a database, but I can if its necessary.

I tried a few things, but nothing has worked so far. The only way I can think of doing this is with an onChange function, but thats javascript…

Edit:
After doing a little more research, I realized I must use a database. I’ll keep working on it.


#2

What you are talking about can only be achieved with the use of JavaScript. If you need to query the database to compile the second list, your best bet is to use AJAX to avoid having to do a page refresh.


si-blog | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#3

you can do it without javascript, but then you would need a submit button that would send the first selection to the server and get back a page with the second dropdown options set accordingly. it’s nice to provide that as well for people who don’t want to run your javascript.

track7 - my dream-hosted site


#4

Only if you reload the existing page, or submit to a separate page. The OP seemed to indicate that a reload was undesirable from the way the post was worded.


si-blog | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]