I have a form that has labels like the Internet, sink, Windows, etc. Each label has different parameters like Yes, No, Price includes, price excluded, etc. And all are coming from the database. These parameters may be the same or different for each label. But I am not able to identify the parameter for each label’s on-page submission. ie, for example, I selected price included for windows but failed to identify price included for which label internet, windows or sink. How is this possible in yii2? My form is attached here.
Hello @maya.a, when you are generating the HTML/widget based form, even if comes from database 1 thing its the label, and the other things are inputs (here you can identify what option the user selects).
I can give you some idea, for each input you can set the name like this
<input type="radio" name="internet[yes]"> <input type="checkbox" name="internet[paid]">
<input type="radio" name="windows[yes]"> <input type="checkbox" name="internet[water_included]">
After this nomenclature, on your POST you will recieve an array with this structure :
'internet' => [
'yes' => 1,
'paid' => 0
'windows => [
'yes' => 1,
'water_included' => 1
I hope this help you
If you need more specific help send the code tell me your doubts