i have created a dynamic menu page with categories, sub-categories and items that can be a part of any categories (the sub-categories can go till n-levels) these are saved in 2 tables one category [columns- id(for id of that category or sub-category), name (the category name) and parent_id(foreign key to id referencing the parent of that category in the same table, main categories are marked “NULL” for this field)] and item [columns- id , name, category_id (foreign key to id in category table)]. what i want is to create an edit page for this dynamic menu with options to edit (the name is there are typos), delete (for deleting either category or item), and add (to add category or item to anyone for the fields) and the main category (the ones whose parent_id are marked null) can be added to a category to name them a sub-category. what should be the layout and the basic idea for this to work I cant think how to address this all, i have codes )or all these functions but I dont know how to address or mark what field (category, sub-category or item) on which i want to perform these functions
what i tried to do was to create 2 drop downs to select these fields one field being parent other child when you choose a child of any parent(category) and select it the child becomes the parent can you can dynamically see its “child” categories and items and can perform functions on the child. But this had multiple issues what if i want to edit the parent which is not child to anyone how would i perform functions on that and add main category (null in parent_id field) to another category