Re: [PHP-DB] Dynamic Drop Down Box
On 3/5/02 3:34 PM, Leotta, Natalie (NCI/IMS) [EMAIL PROTECTED] wrote: This can be done with JavaScript - I don't know if you can do it in PHP. ...unless the drop-downs are on separate pages. E.g.: page 1 just asks for make, once selected, load up page 2 with choices appropriate to the first drop down. Certainly, javascript is cooler. -- Ed Marczak [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Dynamic Drop Down Box
If they want two pages they wouldn't need JS though - just submit and use that in your second query to populate drop-down #2. I had assumed that they wanted it on the same page - which is definitely cooler :-) Good point though - I should have asked which way they wanted to do it. I suppose if you really wanted to be able to say your site used JS you could still use it to set a hidden value in the form and submit it to the next page that way. -Natalie -Original Message- From: Edward Marczak [SMTP:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 10:27 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Dynamic Drop Down Box On 3/5/02 3:34 PM, Leotta, Natalie (NCI/IMS) [EMAIL PROTECTED] wrote: This can be done with JavaScript - I don't know if you can do it in PHP. ...unless the drop-downs are on separate pages. E.g.: page 1 just asks for make, once selected, load up page 2 with choices appropriate to the first drop down. Certainly, javascript is cooler. -- Ed Marczak [EMAIL PROTECTED] -- 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 Drop Down Box
on 3/6/02 10:31 AM, Leotta, Natalie (NCI/IMS) at [EMAIL PROTECTED] appended the following bits to my mbox: If they want two pages they wouldn't need JS though - just submit and use that in your second query to populate drop-down #2. I had assumed that they wanted it on the same page - which is definitely cooler :-) Good point though - I should have asked which way they wanted to do it. I suppose if you really wanted to be able to say your site used JS you could still use it to set a hidden value in the form and submit it to the next page that way. I figured I'd throw something in too. I personally don't like the client side scripting option because it adversely affects accessibility. If you choose the client side option, you should also have a non JavaScript version as well (the 2 pages mentioned before) for site visitors that have other types of interfaces that don't understand JavaScript or for visitors that have dynamic scripting turned off (not a bad idea these days with all the XSS cookie stealing stuff). That said, WebReference has a great tutorial and a bunch of code that you can use to make the nifty related drop-down menus. You can see the theory and tutorial here: http://webreference.com/dev/menus/ And they even have a script that'll generate the code for you here: http://webreference.com/js/tools/menus/ Hope that helps. Sincerely, Paul Burney http://paulburney.com/ ?php If ($your_php_version 4.1.2) { upgrade_now(); // to avoid major security problems /* Please see http://security.e-matters.de/advisories/012002.html */ ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Dynamic Drop Down Box
This can be done with JavaScript - I don't know if you can do it in PHP. I had a site where I wanted to let people compare data for two states so based on the first state that was chosen I populated the compare with the other states. If you want me to send you my code I can. It uses another file too - that one is a big JS array with all of the states in it. I also do one that populates a county box based upon a state. -Natalie -Original Message- From: Rankin, Randy [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, March 05, 2002 3:32 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Dynamic Drop Down Box Does anyone know how I might populate a drop down box based on the users selection from a previous drop down box? For example, if I have a table called 'autos' with 2 fields, 'make' and 'model'. I select distinct 'make' and populate the first drop down box. Based on the user selection, the 2nd drop down box would be populated with the distinct 'make' for that model (ie; if the user selects Ford in the first drop down, the 2nd drop down would be populated with Explorer, Expedition, Ranger, etc.). Thanks, Randy Rankin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php