1. 程式人生 > >tp5 select回顯

tp5 select回顯

php span value == lis code IV pre set

<select name="role_id" id="" class="form-control" required>
    {volist name="roleData" key="key" id="vo"}
        <option value="{$vo.id}" {php}if(isset($data[role_id])){   {/php} {$data[role_id]==$vo[id] ? selected : ‘‘}{php}}{/php}>{$vo[name]}</option>
    {/volist}
<select
name="role_id" id="" class="form-control" required> {volist name="roleData" key="key" id="vo"} {eq name="vo[‘id‘]" value="$data.role_id"} <option value="{$vo[‘id‘]}" selected>{$vo[name]}</option> {else/} <option value="{$vo[‘id‘]}">{$vo[name
]}</option> {/eq} {/volist} </select>

註意:

select()出來的結果才可以volist

tp5 select回顯