Re: Dynamic dropdown lists (select)

From: Date: Mon, 07 Apr 2008 01:30:38 +0000
Subject: Re: Dynamic dropdown lists (select)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-272602@lists.php.net to get a copy of this message
Hello, on 04/04/2008 07:51 AM Angelo Zanetti said the following: > I am looking at options for creating a dynamic dropdown list. > > Ok here is the scenario: > > All values in the dropdown list (select/option field) are coming from the > database. > > So there will be 2 dropdown lists. First one say gets (for example) a list > of cars, > > Then once the car is choosen the second list is populated with the list of > models for the car choosen. > > I would like to know if its possible to do this without posting as well as > without the use of JS. I have seen js examples where the values are all > stored in arrays. > > This is not desireable as I will be getting the values from the the DB using > PHP, unless I can write the JS values to the arrays using PHP? Also not sure > of that. > > Is there any other idea or thing I can do? Im thinking maybe AJAX but this > is for a mobile site (WAP/xHTML) site and Im not sure if the functionality > will work on these devices. This forms generation class comes with a plug-in that does exactly that. http://www.phpclasses.org/formsgeneration It requires some Javascript to send AJAX request to the server, so the plug-in itself queries the database and sends the select input options o the browser. But you do not have to worry because the class generates all the necessary Javascript for you. Here is a live example of the plug-in: http://www.meta-language.net/forms-examples.html?example=test_linked_select You may also want to watch this tutorial video: http://www.phpclasses.org/browse/video/1/package/1/section/plugin-linked-select.html -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/

« previous php.general (#272602) next »