在下拉菜单中的选项 用动态方式添加 提高项目可扩展性
HTML部分
<span style="font-family:KaiTi_GB2312;font-size:18px;"><tr>
<td width="84" align="right">全宗编号:</td>
<td colspan="2">
<select name="full_model_num" id="select">
<foreach name="arr" item="vo">
<option value="{$vo.FULL_MODEL_ID}">{$vo.FULL_MODEL_NUM}</option>
</foreach>
</select>
<!-- <label for="select"></label>
<select name="FULL_MODEL_ID" size="1" id="select">
<option>0001湖南大学全宗</option>
<option>0002湖南大学全宗</option>
</select> -->
</td>
</tr></span>
<span style="font-family:KaiTi_GB2312;font-size:18px;">public function Filesrecording2(){//href地址名与函数名一致
$type=M('fullmodel');
// $arr['a'] = 'aa';
$arr=$type->select();
// var_dump($arr);//打印
$this->assign('arr',$arr);
$this->display("Filesrecording2");//所在页面
}</span>
下拉菜单设置默认值 控制器函数一样
前台加一个判断 注意condition中不支持点语法
<tr>
<td width="100" align="right">全宗编号:</td>
<td colspan="2">
<select name="full_model_num" id="select">
<!-- <option selected="true" value="{$data['FULL_MODEL_ID']}">{$data['FULL_MODEL_NUM']}</option> -->
<foreach name="arr" item="vo">
<option value="{$vo.FULL_MODEL_ID}" <if condition="($data['FULL_MODEL_NUM'] eq $vo['FULL_MODEL_NUM'])">selected</if>>{$vo.FULL_MODEL_NUM}</option>
</foreach>
</select> </td></tr>