/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Product_cat::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['cat_id' => $this->cat_id]);
     $query->andFilterWhere(['like', 'cat_name', $this->cat_name]);
     return $dataProvider;
 }
/* @var $model backend\models\Product */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="product-form">

    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>

    <?php 
echo $form->field($model, 'prod_name')->textInput();
?>
    
    <?php 
echo $form->field($model, 'cat_id')->dropDownList(ArrayHelper::map(Product_cat::find()->all(), 'cat_id', 'cat_name'), ['prompt' => 'Select Category']);
?>
        
    <?php 
echo $form->field($model, 'file')->fileInput();
?>

    
    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();