Im using Mysql for my database but how do i include more than 1 chained dropdown boxes to this coding because my sql tables also includes things such as statement and location other than commodity.By the way this coding is actually taken from this forum and edited but i cant seem to find any solution in including more than one chained dropdown boxes. Im sorry because i am still new to php and mysql.

Can you explain in a bit more detail what you are actually trying to achieve with a "chained dropdown"? Do you mean that you want, say, a second dropdown which will be populated when the user chooses a value in the first dropdown?

If that's the case, I think you'll need to do it with Ajax, and have a bit of code that triggers when the user selected from the first dropdown. That will then retrieve all the options based on their first selection.

I am finding a way for it to filter these categories and and display the data. From the coding I have posted, I was able to to it with only one category, it is possible to include more categories to filter the data ?

Well, the short answer is "yes". If you want to display multiple drop-downs all at the same time, with the content the same regardless of the selection in any of the other drop-downs, then it's much easier - simply repeat the code you already have (well, maybe simplify it a bit) for each of the drop-down categories. Enclose them all within the single <form> tag so that they are all processed by your form handler.

You seem to be using a template system in the code, which is not something I am familiar with, so the exact method and variable names and so on may well have some additional role to play. But basically it will be a case of repeating the first query (the one that builds $tpl['filter']['commodity']['#values'][]) to build the other drop-downs, and then modifying the second query (which on quick glance it appears is the one building the "results") to take into account which other filters have been selected.

It doesn't need to be using Ajax, as your current code doesn't seem to use that.

The section of code that starts with the comment "Populate user grid" is the bit that actually executes the query based on your filter selection, and sticks the results in the array $tpl['grid']['commodity'], so it would be a case of expanding that code to deal with the additional filter conditions.