I’m new to yii and i’m using a dropdownlist to list some products that i need in my controller.
Here is the view code:
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($company, 'dot_com_name')->staticInput() ?>
<p> You have:<p>
<?php echo $balance?>
<?= $form->field($product,'dot_prod_id')->dropDownList(ArrayHelper::map
(Product::find()->where(['dot_prod_com' =>$company->dot_com_id])->all(),
'dot_prod_id','dot_name'), ['prompt' => 'Select'])?>
<div class="form-group">
<?= Html::submitButton('Redeem', ['class' => 'share']) ?>
</div>
<?php ActiveForm::end(); ?>
In my controller
$product = new Product;
if ($product->load(Yii::$app->request->post())){
echo "<script type ='text/javascript'> alert('ID USER: ".$product->dot_prod_id."');</script>";
echo $product->dot_prod_id;
The alert and the echo doesn’t return nothing… Just blank spaces. Help please!!