Hi guys! Is there any way of changing the contents of a dropdown box due to what was selected in a previous box? For example; Contents of Box 1 might be 'Ram' or CPU's' Can we then change Box 2 dependent on the selection of Box 1 to show its own list? Thanks in advance
With PHP and a page refresh I think you can. There may be an Ajax solution also but about that I know nothing.
No not necessarily. You could use Ajax to send a request to another page and update the next dropdown box. I'm no good with ajax as I haven't spent much time doing stuff like this. But... You can do a page refresh, which you can do a redirect which can be like this: page.php?box1=server1 and then you can have if statements that show only RAM and/or CPU for dropdown #2.
No. The simple way to do it using PHP, assuming you are only going to have one or two branches is to make the process a series of steps where the previously entered information is passed as a $_post[variable] to the same or new page. Sorta like one of those online surveys.
yep, this is very much in use these days, you can use php/ajax pseudocode will be user selects something on dropdown 1 an ajax script executes, querying the database or a predetermined array of data using the value in dropdown 1 as filter dropdown 2 gets populated with the results
Hmmm. I was hoping not to have to manually refresh the page or do a step by step approach. Maybe I'll have to look at making a small flash application or something.
you dont need to do that, through ajax/php you can have a linked dropdown w/o any sort of refresh/reload http://remysharp.com/wp-content/uploads/2007/01/select.html
You're pretty much limited to Javascript, unless you want to go the flash approach.. haha. You could have the data loaded with AJAX techniques, or you could have all the data rendered at one time, then have everything as a hidden display (display:none). when someone selects a certain box, the js would enable the options you want to be shown, then remove when it's not needed. If you went with that approach, I'd highly recommend a cache system to be involved. Hope this helps.
This looks promising. I'll see if I can make sense of the source. [edit]any idea where I can find the original post for this link?[/edit]