【发布时间】:2019-10-30 15:33:12
【问题描述】:
我正在使用 sumoselect (http://hemantnegi.github.io/jquery.sumoselect/sumoselect_demo.html) 和 CodeIgniter。我正在显示来自数据库的数据。我在数据库中插入产品类型多个数据,如
producttype
1
1+2
1+2+3
我在 HTML 页面上这样显示
<select name="producttype[]" class="form-control multipleselect event_stop" id="producttype" multiple="multiple">
<option value="" selected disabled>Select</option>
<option value="1" <?php if($post->producttype =="1") echo 'selected'; ?>>One</option>
<option value="2" <?php if($post->producttype =="2") echo 'selected'; ?>>Two</option>
<option value="3" <?php if($post->producttype =="3") echo 'selected'; ?>>Three</option>
<option value="4" <?php if($post->producttype =="4") echo 'selected'; ?>>Four</option>
</select>
如果我从数据库中得到 1,然后选择显示 One 的下拉菜单,但有时我得到 1+2 或 1+2+3,那么如何在选择下拉菜单中显示?
你能帮我解决这个问题吗?
【问题讨论】:
标签: php jquery html codeigniter-3 sumoselect.js