NerdConcepts Posted April 25, 2007 Share Posted April 25, 2007 Ok, here is what I'm doing. When you select a item from a drop down menu it used ajax to call to a PHp file which gets another select boxes contents. That works fine as long as it's static. Ex: You select "1" from the first Select Box "1a" "1b" drops in the second Select Box Code is: case "1": echo "obj.options[obj.options.length] = new Option('1a','1a');\n"; echo "obj.options[obj.options.length] = new Option('1b','2b');\n"; break; When it calls to the PHP it's getBox.php?code=x What I am trying to do is take the x and put it in for the "1" on the case, that away I can run a query to take the "x" value and run a query to find the other matching items from the database, since the first box is created in PHP from the database. I've been searching and searching and can't find anything like this, or should I not being using a case, should I just take the value of x and run a query then do the whole "mysql_fetch_array" stuff and make it where for each item matching in the database make a echo "<select>..." ? Not sure really. Link to comment https://forums.phpfreaks.com/topic/48563-dynamic-casing/ Share on other sites More sharing options...
Barand Posted April 25, 2007 Share Posted April 25, 2007 Say first select is "country" and second is "customer" If user selects country X form the first then SELECT cust_id, cust_name FROM customer WHERE country = "X" to populate the second Link to comment https://forums.phpfreaks.com/topic/48563-dynamic-casing/#findComment-237947 Share on other sites More sharing options...
NerdConcepts Posted April 25, 2007 Author Share Posted April 25, 2007 I went ahead and just wrote everything exactly fit my application. Got it working great, locally. Just ran into problems when I was testing on the server. I have no idea what is going on. I've tested the php files to populate the 2nd box and it works just perfectly. Just won't actually populate when running it through the search page. So I wouldn't think this is a PHP problem, I would have to think it's an AJax problem. Link to comment https://forums.phpfreaks.com/topic/48563-dynamic-casing/#findComment-238295 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.