Here is my forum which is using checkbox list but when I am using radio list it is showing error What was there already.
<?= $form->field($model,'checklist')->checkboxList([ 'advertisers' => 'advertisers', 'publisher' => 'publisher']); ?>
What I have tried
<?= $form->field($model,‘checklist’)->radioList([ ‘advertisers’ => ‘advertisers’, ‘publisher’ => ‘publisher’]); ?>
I am getting output but after I submitted the forum throwing an error
An invalid value is supplied for each
$permissionList = $_POST['SignupForm']['checklist'];
foreach ($permissionList as $value) {
$newPermission = new AuthAssignment;
$newPermission->user_id = $user->id;
$newPermission->item_name = $value;
$newPermission->save();
}
Where am i going wrong?
newbiedo
(Apsprint)
2
Check the values you are getting with var_dump($_POST[‘SignupForm’][‘checklist’]).
I am getting
string(9) "publisher"
also advertiser as well If i use check box list the var_dump returning
array(1) { [0]=> string(11) "advertisers" }
$permissionList[] = $_POST[‘SignupForm’][‘checklist’];
Adding this solved the problem.