<% verify categoryID = request.querystring("categoryID") level = request.querystring("level") set objDB = OpenDatabase(true) Select case level case 2 SQL = "Select Category as Category1, ID as Category1ID, '' as Category2, '' as Category2ID, '' as Category3, '' as Category3ID, '' as Category4, '' as Category4ID from Category1 where ID = '" & categoryID & "'" case 3 SQL = "Select C1.Category as Category1, C1.ID as Category1ID, C2.Category as Category2, C2.ID as Category2ID, '' as Category3, '' as Category3ID, '' as Category4, '' as Category4ID from Category1 C1, Category2 C2 where C2.ID = '" & categoryID & "' AND C2.Category1ID = C1.ID" case 4 SQL = "Select C1.Category as Category1, C1.ID as Category1ID, C2.Category as Category2, C2.ID as Category2ID, C3.Category as Category3, C3.ID as Category3ID, '' as Category4, '' as Category4ID from Category1 C1, Category2 C2, Category3 C3 where C3.ID = '" & categoryID & "' AND C3.Category2ID = C2.ID AND C3.Category1ID = C1.ID" case 5 SQL = "Select C1.Category as Category1, C1.ID as Category1ID, C2.Category as Category2, C2.ID as Category2ID, C3.Category as Category3, C3.ID as Category3ID, C4.Category as Category4, C4.ID as Category4ID from Category1 C1, Category2 C2, Category3 C3, Category4 C4 where C4.ID = '" & categoryID & "' AND C4.Category3ID = C3.ID AND C3.Category2ID = C2.ID AND C3.Category1ID = C1.ID" end select set rsCategory = CreateRecordset(objDB, SQL) section = "Content" %>
:: <%=section%>

Add New Subcategory

Parent Category: <% for x = 1 to 4 %> <%= rsCategory("Category"&x) %> <% if rsCategory("Category"&x) <> "" then response.write " -> " next %>
Subcategory:
Content:
Restrict Access: ProMinent Employee
ProMinent Distributor/Rep
Chemical Vendor/OEM
End User

<% for x = 1 to 4 %> <% if rsCategory("Category"&x&"ID") <> "" then %> "> <% end if next %>

<% rsCategory.close set rsCategory = nothing objDB.close set objDB = nothing %>