PHP, JS and HTML hate each other.

I know there are some good web developers here, so don’t even pretend you don’t know what I’m talking about! :stuck_out_tongue:

what I’m trying to do:
I have a website which hosts certain files. These files have categories and subcategories. Now, I’ve created a submit form, which retrieves the currentcategories from the database and prints them into a listbox with specific submit values and names. What I want to do is to have this master category listbox affect the subcategory listbox, so that onChange the subcategory listbox would update and list the subcategories for the selected master category (which would be retrieved from the database via php) Everything should be dynamic and need no refreshing.

I’m sure it’s possible, but how?

Thanks ahead.

I’d just suck it up and deal with a refresh. However, if there’s only one instance of this on the page, then you can pre-query all possibilities with php and load them into a javascript array that your javascript can use to select the proper things. Admittedly, it’s a hack, but it should do the trick for you.

Fweeb - its not that much of a hack if you ask me. Your idea was the first thing that popped into mind when I read his question. I think its ingenious. After all the performance hit on a few lines of text will be minimal and if the categories aren’t going to change frequently he could even hard code them so there won’t be an unecessary database query every time the page loads. (Can be taken care of with caching though I assume)

Meh…

Hacks are generally ingenious, hence they’re hacks. :stuck_out_tongue: