⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Dependent drop down for two tables having many to many relationship



vrajeshdoshi
  • profile picture
  • Member

Posted 06 March 2018 - 06:05 AM

I am using Grocery CRUD and I have two tables 'team' and 'players' respectively. A player can be a part of one team in an tournament and part of another in some other tournament. So a many-to-many relationship exist between 'team' and 'players', which is maintained in a separate joining table. When the user selects a team from a drop-down then only the players belonging to the team should appear in another drop-down and not all the players from the players table. I got few libraries extension for it, but were supporting one-to-many relationship and not many-to-many. Please Help.

 


Dharani
  • profile picture
  • Member

Posted 27 March 2018 - 09:11 AM

First get the value from 'team' dropdown.. and retrieve all the players assigned to that 'team' in the join table.... and get the data one by one from  'player' table and display it in player dropdown.... 

 

 

http://makitweb.com/dynamic-dependent-dropdown-in-codeigniter-with-ajax/

 

this is link shows one to many relationship but you can modifiy it as many to many relationship