Populate Dynamic Dropdown from Database

  • vegasledscreens
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 10
  • Thank you received: 0

vegasledscreens created the topic: Populate Dynamic Dropdown from Database

Hi,

How can I populate a dropdown list from a database based on a previous dropdown that i populated from a database? As far as i could go i did the following:

Main dropdown that i named "type", i put as value:
<?php
$out = '';
$db = JFactory::getDBO();
$db->setQuery("SELECT id, name FROM #__data_type);
$contents = $db->loadObjectList();
foreach( $contents As $content ){
    $out .= '0;'.$content->name.';'.$content->id."\n";
}
return $out;
?>

And for the next dropdown i named it "character", i put the value:
<?php
$out = '';
$db = JFactory::getDBO();
$db->setQuery("SELECT idchar, character FROM #__data_main where id = '$type'");
$contents = $db->loadObjectList();
foreach( $contents As $content ){
    $out .= '0;'.$content->character.';'.$content->idchar."\n";
}
return $out;
?>

But it doesnt give me anything. How can i populate a dynamic dropdown based on the previous dropdown from my database?
#147404
  • vegasledscreens
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 10
  • Thank you received: 0

vegasledscreens replied the topic: Populate Dynamic Dropdown from Database

anyone???
#147508
  • Posts: 15273
  • Karma: 287
  • Thank you received: 1074

pedro81 replied the topic: Populate Dynamic Dropdown from Database

Hi,

look at the solution that Chris gave yesterday here:
crosstec.org/en/forums/40-club-forums-su...lectlist.html#147499

i think that it can be very helpful for your case.

Regards,
Pedro
=========================================Need to renew Pro Support?
Buy Here!
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
Follow us on Twitter
==============================================
#147529
  • vegasledscreens
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 10
  • Thank you received: 0

vegasledscreens replied the topic: Populate Dynamic Dropdown from Database

hi pedro,

ok thank you very much i will check it out. i will let you know if i have it solved.

richard
#147568
  • Posts: 15273
  • Karma: 287
  • Thank you received: 1074

pedro81 replied the topic: Populate Dynamic Dropdown from Database

ok, let us know if it was helpful or not.

Regards,
Pedro
=========================================Need to renew Pro Support?
Buy Here!
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
Follow us on Twitter
==============================================
#147594
  • Posts: 4
  • Thank you received: 0

IamJim replied the topic: Populate Dynamic Dropdown from Database

I also need to do the same thing. Does this work ? If so, i will renew my subscription
#238267
Moderators: ForumSupport
Time to create page: 0.042 seconds

We Are Doing Our Part

Massive discounts on all of our extension subscription plans to help you and your business in these times.

Get Your Subscription Here

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

We are doing our part and support your business with extremely low prices -- For example 6-Months-Subscription for only $9 USD. For as long as necessary.

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!