$row['staff'] = (!isset($row['staff'])) ? "" : $row['staff'];
$row['staff_option'] = get_staff_option($row['staff']);
```
ugm\_stk/function.php
```
#得到業務員的選項
function get_staff_option($sn=""){
global $xoopsDB;
#---- 過濾資料 --------------------------
$myts = &MyTextSanitizer::getInstance();
#外鍵
$sql = "select a.`sn`,a.`title`
from " . $xoopsDB->prefix("ugm_stk_staff") . " as a
where a.`enable`='1'
order by a.`sort`"; //die($sql);
$result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, web_error($sql));
$option = "";
while ($row = $xoopsDB->fetchArray($result)) {
//以下會產生這些變數: $sn , $ofsn , $title , $enable ,$sort url target
$row['sn'] = intval($row['sn']);
$row['title'] = $myts->htmlSpecialChars($row['title']);//
$selected = "";
if ($row['sn'] == $sn) {
$selected = " selected";
}
$option .= "";
}
return $option;
}
```
2.