I want to display parent categories and then subcategories in dropdown

Hi. I have db table named tbl_categories. top 6 are parent categories. there is column named under_category_id. for eg. category id 1 is parent category and under_category_id 1 is sub category of parent category of category_id 1. Below is link to image of db table.


Now i want to show main categories follwed by sub categories. Like this


Now i want to show main categories followed by sub categories. How do you want to display your results, the image shows the final results, and possibly like using JS, so you want to use JS or PHP to get your results as in the pic

Sponsor our Newsletter | Privacy Policy | Terms of Service