I have a list builder widget in yii which looks something like this.
I want to save all the selected values in the right column to my database.How can I pass the selected values to controller? Please help in this regard
I have a list builder widget in yii which looks something like this.
I want to save all the selected values in the right column to my database.How can I pass the selected values to controller? Please help in this regard
I have figured this out for myself.
The widget already includes by default the saving code too.
Here is the link for saving list widget to database.
If you are getting an array after submitting the form then use serialize() and save. (It will convert the array to a formatted string).
$model->attribute=serialize($_POST['modelname']['attribute'])
-----
$model->save();
and use unserialize() while fetching the data.
Or
You can use foreach to traverse through the array and store each selected.