I am attempting to build a category navigation system and so far have all my tables set up and indexed in mysql. My issue is understanding the logic for retrieving the categories I want using php.
I am thinking I need something like:
On click – store clicked category name in variable $category – query variable against database
SELECT subcategory_name FROM subcategories WHERE parent = "$category"
Does this sound right? I think there is not an on click function in php so I am unsure which function should I look into that I can use to assign the category name I click to the variable?
It doesn’t seem like you want to use javascript in your app. You may want to use an anchor tag with $_GET variables to past the selected category e.g
On the page querypage.php, you can get the clicked category like this: