帝国cms 自己定义地区分级的字段

建一个area的表,然后建一个上级地区字段 bareaid

把下列代码加入到管理bareaid字段的输入表单替换html代码中

 

<select name="bareaid" id="bareaid">

<option value=""<?=$r[bareaid]==""?' selected':''?>>顶级地区</option>
<?php
$result = mysql_query("SELECT id,title,bareaid FROM phome_ecms_area where bareaid = '' ");
 
while($row = mysql_fetch_array($result))
  {
 
?>
  <option value="<?php echo $row['id'] ?>"<?php if($r["bareaid"]==$row['id']){ echo "selected='selected'"; }?>><?php echo $row['title'] ?></option>
<?php
  }
  ?>
</select>

·关于我们·免责声明·服务条款·RSS订阅·dede168.com技术支持

Copyright © 1998-2015  All rights reserved.