Confidence Posted February 21, 2010 Share Posted February 21, 2010 how can i get something like this here http://www.javascripttoolbox.com/lib/dynamicoptionlist/ <script type="text/javascript"> var names = new DynamicOptionList(); names.addDependentFields("sex","names"); names.forValue("boy").addOptions("Matt","Bob","Joe","Bill","John"); names.forValue("girl").addOptions("Jane","Angie","Jennifer","Amy","Sue"); names.forValue("boy").setDefaultOptions("Joe"); </script> but instead of the static options (boy, girl...etc)...the data will be coming from a php function as an array...looking like this. Array ( [1] => Array ( [phoneprovider] => tnt-phones [tarif] => Cheap family [phoneproviderID] => 22 [MostPopTarif] => [price] => 1.99 ) [2] => Array ( [phoneprovider] => tnt-phones [tarif] => Cheap single [phoneproviderID] => 22 [MostPopTarif] => [price] => 1.90 ) [3] => Array ( [phoneprovider] => tnt-phones [tarif] => Cheap family plus [phoneproviderID] => 22 [MostPopTarif] => [price] => 1.09 ) [4] => Array ( [phoneprovider] => tnt-phones [tarif] => Xtra time [phoneproviderID] => 22 [MostPopTarif] => 1 [price] => 1.99 ) [5] => Array ( [phoneprovider] => Megatelephone [tarif] => Cheaper XL [phoneproviderID] => 23 [MostPopTarif] => [price] => 1.49 ) [6] => Array ( [phoneprovider] => helloephones [tarif] => call me XL [phoneproviderID] => 24 [MostPopTarif] => [price] => 2.99 ) [7] => Array ( [phoneprovider] => helloephones [tarif] => we call 15% [phoneproviderID] => 24 [MostPopTarif] => [price] => 1.99 ) ) where in first box i have phonecompany and second i have tariff name and when both are selected, price is shown as a result. Link to comment https://forums.phpfreaks.com/topic/192799-dependant-comboxes-from-dynamic-data-array/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.