Insert Data into two table through one form

there are two table in database:

1)asset => asset_id,asset_name.

2)destroy => destroy_id,asset_id,comments,destroy_type.

my question is…

open asset form but show only comments and destroy_type not show asset name field asset table

and write a coments and destroy type just like this commentz=asd and destroy_type=asa

currently available in asset form and clik ok button then save destroy table asset_id ,comments,destroy_type

so please help me how’s possible. in yii 2

I am also facing the same problem. When I press the submit button it shows me the warning that my dates were inserted, but only the second insert works. Table "donator" is empty. What should I do to fix this problem?

I am facing same issue. Please help.

if you call two form so calling different id

if you post data at that time call new model like your new table model name on that you save your records using model instance and save records

  • after that you validate also your model is correct or not if not save data in database that time $model->save(false)