Re: [PHP-DB] Dynamic pull down menus with PHP/Mysql
On Fri, 8 Oct 2004 01:12:06 -0400, GH [EMAIL PROTECTED] wrote: For a project in college that I had once did using ColdFusion and MSAccess (please dont kill me :)) I had the simular situation What I did was when the First Drop Down was changed... it had an onChange action or something of that nature (do not have my exact code infront of me) that went to a JS function which sent the value to another frame (window) you can use a hidden 1x1 iframe to conduct this... it then returned the values to the other page via JS I have to Dig for the code which unfortinately is buried at the moment On Tue, 5 Oct 2004 08:22:22 -0700, Ed Lazor [EMAIL PROTECTED] wrote: -Original Message- This may be a more javascript related topic, but it's also php/mysql. Apologies in advance if this is too far off topic. I'm trying to pull data from MySQL using PHP to sort the results into a form with a pull down menu. That works fine; I can do that. But I have a second pull down menu whose items need to display based on the item chosen from the first pull down menu. I can do two lists seperately, but I need the second pull down menu to be a result of the first, and I can't figure a way to do it in PHP without reloading the page, which I don't really want to do. Is this a javascript-dependent function, in that a js will have to make the call to the database via some sort of scripted php/mysql request? I really like to avoid javascript if possible, but I'm unsure there's an alternative. You're describing what I think is called Dynamic Options. Doing a Google for javascript dynamic option or javascript dynamic select will pull-up a few examples. Most of these solutions will expect you to load all data into javascript arrays. In other words, you don't have to reload the page, because all of the data is already present. This approach doesn't work well when dealing with large amounts of data. If you're running into this, use javascript's window.opener feature. It allows you to spawn a second window that retrieves data and sends it to the first window. Cripes! People are a bit slow today... what you are describing sounds like a hierselect to me: In pear,... http://pear.php.net/package/HTML_QuickForm/docs/3.2.1/HTML_QuickForm/_HTML_QuickForm-3.2.1_QuickForm_hierselect_php.html If you want to do it yourself just look at their code and get your inspiration from there - and yes, their solution is javascript based. Cheers Antoine -- G System, The Evolving GUniverse - http://www.g-system.at -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Dynamic pull down menus with PHP/Mysql
For a project in college that I had once did using ColdFusion and MSAccess (please dont kill me :)) I had the simular situation What I did was when the First Drop Down was changed... it had an onChange action or something of that nature (do not have my exact code infront of me) that went to a JS function which sent the value to another frame (window) you can use a hidden 1x1 iframe to conduct this... it then returned the values to the other page via JS I have to Dig for the code which unfortinately is buried at the moment On Tue, 5 Oct 2004 08:22:22 -0700, Ed Lazor [EMAIL PROTECTED] wrote: -Original Message- This may be a more javascript related topic, but it's also php/mysql. Apologies in advance if this is too far off topic. I'm trying to pull data from MySQL using PHP to sort the results into a form with a pull down menu. That works fine; I can do that. But I have a second pull down menu whose items need to display based on the item chosen from the first pull down menu. I can do two lists seperately, but I need the second pull down menu to be a result of the first, and I can't figure a way to do it in PHP without reloading the page, which I don't really want to do. Is this a javascript-dependent function, in that a js will have to make the call to the database via some sort of scripted php/mysql request? I really like to avoid javascript if possible, but I'm unsure there's an alternative. You're describing what I think is called Dynamic Options. Doing a Google for javascript dynamic option or javascript dynamic select will pull-up a few examples. Most of these solutions will expect you to load all data into javascript arrays. In other words, you don't have to reload the page, because all of the data is already present. This approach doesn't work well when dealing with large amounts of data. If you're running into this, use javascript's window.opener feature. It allows you to spawn a second window that retrieves data and sends it to the first window. -Ed -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Dynamic pull down menus with PHP/Mysql
Remember that PHP is server-side, so if you want PHP to do anything you'll have to send a request back to the server (reload the page). To handle things client side will require the likes of javascript, exactly how is beyond me I'm afraid but I'm sure you could do something like load all values in 2nd drop-down initially and then get javascript to limit the available values dependant on the selection in the first drop-down. Have you tried sites like: http://www.javascript.com http://www.webreference.com/js/ http://www.hotscripts.com/JavaScript/ Chained selects: http://www.hotscripts.com/Detailed/36563.html HTH Graham -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 05 October 2004 15:05 To: [EMAIL PROTECTED] Subject: [PHP-DB] Dynamic pull down menus with PHP/Mysql To the group: This may be a more javascript related topic, but it's also php/mysql. Apologies in advance if this is too far off topic. I'm trying to pull data from MySQL using PHP to sort the results into a form with a pull down menu. That works fine; I can do that. But I have a second pull down menu whose items need to display based on the item chosen from the first pull down menu. I can do two lists seperately, but I need the second pull down menu to be a result of the first, and I can't figure a way to do it in PHP without reloading the page, which I don't really want to do. Is this a javascript-dependent function, in that a js will have to make the call to the database via some sort of scripted php/mysql request? I really like to avoid javascript if possible, but I'm unsure there's an alternative. Goolge et al. have some answers, but have done more to befuddle than clarify. As always, any help is greatly appreciated. --V -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Dynamic pull down menus with PHP/Mysql
-Original Message- This may be a more javascript related topic, but it's also php/mysql. Apologies in advance if this is too far off topic. I'm trying to pull data from MySQL using PHP to sort the results into a form with a pull down menu. That works fine; I can do that. But I have a second pull down menu whose items need to display based on the item chosen from the first pull down menu. I can do two lists seperately, but I need the second pull down menu to be a result of the first, and I can't figure a way to do it in PHP without reloading the page, which I don't really want to do. Is this a javascript-dependent function, in that a js will have to make the call to the database via some sort of scripted php/mysql request? I really like to avoid javascript if possible, but I'm unsure there's an alternative. You're describing what I think is called Dynamic Options. Doing a Google for javascript dynamic option or javascript dynamic select will pull-up a few examples. Most of these solutions will expect you to load all data into javascript arrays. In other words, you don't have to reload the page, because all of the data is already present. This approach doesn't work well when dealing with large amounts of data. If you're running into this, use javascript's window.opener feature. It allows you to spawn a second window that retrieves data and sends it to the first window. -Ed -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php