下拉选择
效果如下
前端代码如下:
<select name="bid">
<option value="0">请选择品牌</option>
<volist name="plist" id="vo">
<option value="{$vo['id']}" <if condition="$vo['id'] eq $pid">selected</if>> {$vo["br_name"]}
</option>
</volist>
</select>
其中 <if condition="$vo['id'] eq $pid">selected</if>
这一句效果何在??
以下是volist标签中的数据读取
public function productadd(){
$cid=I("get.cid");
$pid=I("get.pid");
if (!is_numeric($cid)){$cid=0;}
if (!is_numeric($pid)){$pid=0;}
***$plist=$this->brand_arr();***
$clist=$this->chanel();
$maxsort=M("odee_product")->field("pr_sort")->order("pr_sort desc")->find();
if (!$maxsort){
$pr_sort=1;
}else{
$pr_sort=$maxsort['pr_sort']+1;
}
$this->assign(array("pid"=>$pid,"cid"=>$cid,"plist"=>$plist,"clist"=>$clist,"pr_sort"=>$pr_sort));
$this->display();
}
public function brand_arr(){
$list=M("odee_brand")->field(true)->order("br_sort")->select();
return $list;
}