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.

https://secure.eu.internxt.com/sh/file/717a494e775b37660956/63de858ccd8bdce2a14af768c0043b62e9697213ed0c9a9a08cc07011f0734d0

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

https://secure.ue.internxt.com/sh/file/d032de8c9e36cbc089fc/ddb1bff0748a4cadb6ebeaff36fb8fdd82730789a7ade288265827fcb9d5ae8f

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