1. 先去数据库中查值,查询整个数据表,结果为二维数组。
$project = M("project");
$cell = $project->where(array(‘status‘=>1))->order("id desc")->select();
//var_dump($cell);
$this->assign(‘cell‘,$cell);
2.前台获取遍历
<select class="test" style="width:88%;height:35px;border-style:none;color:#767676;" id="projectno" name="projectno"> <option> 请输入您的所在小区</option> <volist name="cell" id="vo"> <option value="{$vo[‘id‘]}">{$vo[‘name‘]}</option> </volist> </select>
原文:http://www.cnblogs.com/yangzailu/p/6308618.html