In reference to this:
http://sqllessons.com/categories.html
Change parentid NULL to 0

Let's say I have 6 levels of subcategories.
How do I have chained select dropdown based on the main category which has a 0 value under parentid, then show it's subcategoryLevel1 > SubcategoryLevel2 > and so on.

Stops when there are no more subcategory.

$sql = "SELECT name FROM criteria WHERE parentid='0'"; //main category
** codes to show 1st level of category**

if a user selects main category with id ___
$sql = "SELECT name FROM criteria WHERE parentid='$id'"; //sub category

and loop goes on.

Please help. Thank you in advance!

Another example:
http://lvasquez.github.io/2013/08/19/dynamic-combobox-with-codeigniter/
Though it's only 1 level.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.