L
L
lzy2018-12-10 21:07:17
Yii
lzy, 2018-12-10 21:07:17

How to pass value from option to controller?

There are product dimensions, how to send the value selected by the user to the controller?

<?php if ($product->productSize) {?>
                                    <select name="product__select" class="product-select__size" id="order-size" name="size">
                                        <?php foreach ($product->productSize as $v) {?>
                                            <?php if ($v->size) {?>
                                                <option value="<?=$v->size->id;?>"><?=$v->size->name;?></option>
                                            <?php }?>
                                        <?php }?>
                                    </select>
                            <?php }?>

And the controller itself
$order_items->size_id = $item['size_id']; // Как здесь получить otion value?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rhesus Negative, 2018-12-11
@RhesusNegative

you have 2 name in select... remove one and get it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question