我想生成 其中选项是动态生成的。 p>
有一个 我可以 生成选择输入字段 p>
但这里生成的选项长度为5。 我希望它是根据 select code>输入字段,如 p>
< select name =“quantity”>
< option value =“”> Quantity< / option>
< option value =“1”> 1< / option>
< option value =“2”> 2< / option>
< option value =“3”> 3< / option>
< / select>
code> pre>
stock code>列,其中包含int值。 我想生成与股票价值一样多的期权。 例如:如果
stock code>值为5,则选项将从
1 code>到
5 code>。 p>
$ this-> Form-> select('quantity',[1,2,3,4,5],['empty' =>'数量'])
code> pre>
stock code>列中的值生成的。 p>
div>
I want to generate select
input field like
<select name="quantity">
<option value="">Quantity</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
where option is generated dynamically.
There is a stock
column which contains int value. I want to generate options as much as value in stock. Ex: If stock
value is 5 then option will be from 1
to 5
.
I can generate select input field by
$this->Form->select('quantity', [1,2,3,4,5], ['empty' => 'Quantity'])
But here options generated will of 5 length. I want it to be generated as per the value in stock
column.