function makeDepartmentList($current_dept_id, $count, $cmpid) { static $option_results; if (!isset($current_dept_id)) { $current_dept_id = 0; } $count = $count + 1; $sql = "SELECT nDeptId as id, vDeptDesc as name from sptbl_depts where nDeptParent = '{$current_dept_id}' and nCompId='{$cmpid}' order by name asc"; $get_options = mysql_query($sql); $num_options = mysql_num_rows($get_options); if ($num_options > 0) { while (list($dept_id, $dept_name) = mysql_fetch_row($get_options)) { if ($current_dept_id != 0) { $indent_flag = " "; for ($x = 2; $x <= $count; $x++) { $indent_flag .= "--> "; } } $dept_name = $indent_flag . htmlentities($dept_name); $option_results[$dept_id] = $dept_name; makeDepartmentList($dept_id, $count, $cmpid); } } return $option_results; }
} ?> <div class="content_section_title"><h4><?php echo TEXT_SELECT_DEPARTMENT_AND_CATEGORY; ?> </h4></div> <table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" class="comm_tbl"> <tr> <td align ="left"> <?php echo makeDropDownList("ddlDepartment", makeDepartmentList(0, 0, $_SESSION['sess_usercompid']), $ddlDepartment, "comm_input width1", "\" style=\"width:270px;\" \"", "onChange=\"javascript:changeDepartment();\""); echo " "; echo makeDropDownList("ddlCategory", makeCategoryList(0, 0, $ddlDepartment), $ddlCategory, "comm_input width1", "\" style=\"width:200px;\" \"", "onChange=\"javascript:changeCategory();\""); ?> </td> </tr> </table> <div class="content_search_container"> <div class="left rightmargin topmargin"> <?php echo TEXT_SEARCH; ?>