I need an effective solution for users to select categories and sub-categories (either list or checkbox), retain that information, then write it to a DB.
For example, I have three tables in my SQL database that hold category names: ? TopCategory, SubCategory1, SubCategory2. ? Each table has the following fields: ? categoryid, name, description, status.
I also have three tables that hold the relationship between between the categories: ? hierarchy_SubCategory1, hierarchy_SubCategory2. ? Each table has the following fields: ? hierarchyid, parentCategory, subCategory. ? For hierarchy_SubCategory1, the parentCategory is TopCategory and for hierarchy_SubCategory2 the parentCategory is SubCategory1.
The hierarchy looks like this:
Top Category
|_SubCategory1
|_SubCategory2
There are multiple top categories and sub categories. ? Essentially, I'm creating a user access form where an admin could select what categories a user has access to. ? I need some way for the admin to select various combinations of Top Category, Sub Category1 and SubCategory2, then write that to access tables I have setup in my database. ? I'm fine with checkboxes, list boxes or any other efficient method to present the selection to the admin. ? Would also like the admin to have the ability to 'select all' for a particular sub category (i.e., if using checkboxes to select sub categories, there should be a checkbox that selects all).
The access tables are: ? access_topCategory, access_subCategory1, and access_subCategory2. ? Each table has the following fields: ? accessid, userid, categoryid
My site is written in PHP and I'm using MySQL. ? If JavaScript is necessary, that's OK.
## Deliverables
Feel free to ask questions if I haven't been clear on what I need. ? I also have a tight timeframe on this and need the code in the next 24 hours. ? Thank you!!