Hi Vail, You are 100% correct on all the items you've mentioned. That's why I'm trying to get the less painful solution for this. I believe I'll end up reloading the page on each selection since I'll have only 3 or 4 dropdown menu to be processed by PHP and the server response is good so far. Kind regards,
Francisco -----Original Message----- From: Vail, Warren [mailto:[EMAIL PROTECTED] Sent: August 30, 2004 4:32 PM To: Francisco Puente XFMP (QA/EMC); Brent Clements; [EMAIL PROTECTED] Subject: RE: [PHP] PHP- Dependant dropdown based on Mysql queries You are presented with some difficult design choices and limitations. The way I believe you are envisioning things may not work. The problem that you face is that PHP only runs on the server when preparing the page. You are asking some interactions to take place once the web page is presented by your browser, and JavaScript is the language of choice to make this happen because it runs in your browser, however, it cannot access your database directly (that I know of), so you are forced to go back to PHP which must access the database again, and present a new, slightly different page, reflecting your visitors choices so far (I don't believe there is a way for PHP to update part of a page unless it is allowed to update a hidden frame and JavaScript gets the new data from the hidden frame [a level of complexity and risk I'd not want to take on]). If the data required to support the choices is small enough (and you indicated it was not), loading things into a JavaScript array, and letting JavaScript step through the choices using the arrays would give the best apparent response, but the choice almost becomes one of accepting a long response to preload all the data in one page, or suffer the slow response of having each menu selection have to go back to the server and rebuild the page. Good luck, Warren Vail -----Original Message----- From: Francisco Puente XFMP (QA/EMC) [mailto:[EMAIL PROTECTED] Sent: Monday, August 30, 2004 12:28 PM To: Brent Clements; [EMAIL PROTECTED] Subject: RE: [PHP] PHP- Dependant dropdown based on Mysql queries Hi Brent, I believe this is the way to go, but since I'm not a javascript guy I would like to get some php help for doing this. I you know some javascript can you please post some code for this task? Someone else proposed to query ALL the information from the database to populate the javascript code to be used but I disregard this since the data from the database is pretty big and a lot of user accessing at the sime will put the load on the roof. I'm sure there is an easier way to go.. Thanks a lot! Francisco -----Original Message----- Using a combination of javascript and php this is easily done. Below is just a way off the top of my head. There are probably simpler ways of doing it or even more elegant but again this is just off the top of my head. You would populate your first dropdown box by whatever method. Then you would do an onselect javascript event to submit the form, the php code would check to see what "step your at" by seeing which select form field was submitted and then take the value of select form field , query against the value, and then use the results to populate the other select form fields. Wash, rinse, repeat. -Brent ----- Original Message ----- > Hi All, > I'm trying to generate a PHP page with 3 or 4 dropdown menus, each of > one dependant upon each other, that means: > #2 dropdown should change upon selecting something on dropdown #1, #3 should change based on the selection at #2 to finally submit the desired query. Each dropdown menu should be generated from a mysql query based on the previous selection. > I need to generate mysql queries based on each dropdown selection and > the page should reload the content for the next dropdown menu. I couldn't yet figure out how to accomplish this. > Let me know if I make myself clear enough :) > Any help is very welcome!! > > Thanks in advance, > > Francisco > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php