How to insert the data selected from a form also in other tables of the database

Hi everyone, I need to insert the values ​​selected from a form via dropdown list (therefore related to other tables) also in other columns of other tables of the same database. Where can I find an example from which to take inspiration? In the guide I read the insert () method but I can’t understand it.

Try using dropDownList widget described at YII2 API

There is a video by Luke Briner on YouTube, look at video 5

HTH

1 Like

Thanks @mbunyan, the form with all the fields in the dropdown list I have already entered, the problem is in the mysql database part. Place code because it is complex to explain.


This is the form, let’s call it the main one, each field recalls values ​​from other models (there are many), and this works well.
In every other model (almost) I have also inserted the column (also mysql) which reports for example that a pc number is associated with an ip address that I previously selected through the main form. On mysql, however, the value remains null.
In view the association works fine.

The structure
mysql2
But in mysql remain always Null