<textarea class="ckeditor" cols="70" id="FCKeditor1" name="FCKeditor1" rows="10"> <?php echo $word; ?> </textarea></td> </tr> <tr style="display:none;"> <td align="right" class="td1">相關商品:</td> <td align="left" class="td2"><div style="padding-bottom:5px"> <select name="pro_kind2" id="pro_kind2" onchange="getData('pro_other.php?kind=' + this.value + '&pro_other=' + document.getElementById('pro_other').value + '&num=<?php echo $_GET["num"]; ?> ','pro_other_div');"> <option value="">請選擇</option> <?php echo build_kind("pro_kind", 0, 1, ""); ?> </select> </div> <div style="width:550px; height:100px; border-style:solid; border-width:1px; border-color:#999999; background-color:#FFFFFF; overflow:auto"> <div id="pro_other_div"></div> </div> <input name="pro_other" id="pro_other" type="hidden" value="<?php echo $pro_other; ?> " /> <div id="pro_other_div2"></div></td> </tr> <tr> <td align="right" class="td1">图档1:</td> <td align="left" class="td2"><input type="file" name="upload[]">
function build_kind($tb, $root, $lv, $value) { //建立分類 $tmp = ""; $d = ""; for ($i = 1; $i < $lv; $i++) { $d .= "…"; } $sql = "select * from `" . $tb . "` where `root`=" . $root . " order by `range`"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $s = ""; if ($value != "") { if ($value == $row["num"]) { $s = "selected=\"selected\""; } } $tmp .= "<option value=\"" . $row["num"] . "\" " . $s . " >" . $d . $row["kind"] . "</option>"; $tmp .= build_kind($tb, $row["num"], $lv + 1, $value); //建立次分類 } return $tmp; }