如果是要修改要咋样赋值啊
function getList($pid=0,&$result=array(),$spac=0){
$spac = $spac + 2;
$sql = "SELECT * FROM news_type WHERE pid=$pid";
$res = @mysql_query($sql);
while($row = mysql_fetch_assoc($res)){
$row['catename'] = str_repeat(' ',$spac).'|--'.$row['catename'];
$result[] = $row;
getList($row['id'],$result,$spac);
}
return $result;
}
function displayCate($pid=0,$selected=1){
$rs = getList($pid);
$str='';
$str.= "<select name='pid' class='dfinput'>";
foreach($rs as $key => $val){
if($val['id'] == $selected){
$sellectedstr ="selected";
}
else{$selectedstr =$val['id'];}
$str.= "<option {$selectedstr}>{$val['catename']}</option>";
}
}