Hello. There are two tables: Laws and Groups. There are many to many connections - there can be several laws in one group and one law can consist of several groups. The fact is that when creating laws there is a need to put the law in several groups at once. To do this, I create several fields under the law equal to the number of groups in order to fill in the names there (in fact, the group id will be sent to the server). The problem is that it is impossible to fill one table field at the same time. How, then, to be? Maybe in YII it can be solved by standard means?

    2 answers 2

    Look in the direction of the table entry. You can create a form of "law" and under it several forms of "group".

    Working with Forms: Tabular Input

      if the connection is many-to-many. I've done this

      there is a detailed instruction. in short, everything goes with the help of relations and as a result we get something like

      enter image description here