Hope you're having a nice day and i'm much clear to describe my problem :)

I have a table of categories and a table of sub-categories. In my view, I want to let the user select a sub-category belonging to a category, for adding a product (Every product belongs to a sub-category). For that purpose, I want to show the user sub-categories when he selects a category. Like when he selects Clothes from Categories, I want to show Sub-categories like tops, shorts etc.

How do I do that? Just an idea would work.

Thanks.