donglvmang8638 2019-01-22 10:02
浏览 52

Tree-Style Multi select下拉列表从mysql获取数据

I want to implement drop-down list with multiple group selection checkbox. There are a lot of options,so I use mysql to save them. How could i get data from mysql to use as option.I want to use php to retrieve data and they must be hierarchical tree structure.

I use this sample code, but option value is directly entered. How to make it display herarchical form as image below. This is the code:

<!DOCTYPE html>
<html>
<head>
<script 
src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"> 
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3- 
typeahead/4.0.2/bootstrap3-typeahead.min.js"></script>
<link rel="stylesheet" 
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" 
/>
<script 
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"> 
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap- 
multiselect/0.9.13/js/bootstrap-multiselect.js"></script>
<link rel="stylesheet" 
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap- 
multiselect/0.9.13/css/bootstrap-multiselect.css" />
</head>
<body>
<div class="container" style="width:400px;">
    <form method="post" id="framework_form">
        <div class="form-group">
            <label>Select which Framework you have knowledge</label>
            <select id="framework" name="framework[]" multiple class="form-control">
                <option value="Codeigniter">Codeigniter</option>
                <option value="CakePHP">CakePHP</option>
                <option value="Laravel">Laravel</option>
                <option value="YII">YII</option>
                <option value="Zend">Zend</option>
                <option value="Symfony">Symfony</option>
                <option value="Phalcon">Phalcon</option>
                <option value="Slim">Slim</option>
            </select>
        </div>
    </form>
    <br />
</div>
</body>
</html>
<script>
$(document).ready(function () {
    $('#framework').multiselect({
        nonSelectedText: 'Thêm khách mời',
        enableFiltering: true,
        enableCaseInsensitiveFiltering: true,
        buttonWidth: '400px'
    });


});
</script>

Sorry for my bad English and Thanks for reading. enter image description here

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?
    • ¥15 matlab(相关搜索:紧聚焦)
    • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
    • ¥15 路易威登官网 里边的参数逆向
    • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
    • ¥50 需求一个up主付费课程