Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

yii2 how to pass the user input in text input to make as a where condition for dropdownlist?

i want to get the user input in field form "username" and pass it as a condition in dropdownlist in where

this is the form field

<?= $form->field($model, 'Username')->textInput(['maxlength' => true,'readonly' => true]); ?>

this is my code to get the input

$input=Html::getInputId($model, 'Username');

this is my code for dropdownlist

<?= $form->field($model, 'appTime')->widget(Select2::classname(), [
        'data' => ArrayHelper::map(Schedule::find()
           ->where(['user' => $input])
            ->andWhere(['availability'=> 'available'])->all(),'time','time'),
        'language' => 'en',
        'options' => ['placeholder' => 'Select time available'],
        'pluginOptions' => [
        'allowClear' => true
        ],
    ]);
    ?> 

but it didnt give an output for the dropdown which means the condition failed. what should i do ?

can anybody tell me how to pass the input when user fill in the textinput ?

Comments