TOPIC:

Populate Dynamic Dropdown from Database 5 years 8 months ago #147404

  • Topic Author
  • vegasledscreens
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 10
  • Thanks: 0
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?

Please Log in or Create an account to join the conversation.

Populate Dynamic Dropdown from Database 5 years 8 months ago #147508

  • Topic Author
  • vegasledscreens
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 10
  • Thanks: 0
anyone???

Please Log in or Create an account to join the conversation.

Populate Dynamic Dropdown from Database 5 years 8 months ago #147529

  • pedro81's Avatar
  • pedro81
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 15273
  • Karma: 287
  • Thanks: 1077
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.

Please Log in or Create an account to join the conversation.

Populate Dynamic Dropdown from Database 5 years 8 months ago #147568

  • Topic Author
  • vegasledscreens
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 10
  • Thanks: 0
hi pedro,

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

richard

Please Log in or Create an account to join the conversation.

Populate Dynamic Dropdown from Database 5 years 8 months ago #147594

  • pedro81's Avatar
  • pedro81
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 15273
  • Karma: 287
  • Thanks: 1077
ok, let us know if it was helpful or not.

Please Log in or Create an account to join the conversation.

Populate Dynamic Dropdown from Database 1 year 3 months ago #238267

  • IamJim
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 4
  • Thanks: 0
I also need to do the same thing. Does this work ? If so, i will renew my subscription

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.051 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

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!