PHP search function


I made a website with products in it and every product categorized. I also have a search function which works, but what I’m trying to do is when I click a category I want to be able to search products in that category only and if the searched term is not in that category it shows nothing. The current state of my search functions is that it doesn’t search in the category, it searches the whole database even though I clicked on a category. Here is link

EDIT: Can also add on Discord so I can show it live how it supposed to work


Your text search form needs to include any category selection as a hidden field and the SELECT query needs to use both the category selection, if any, and the text field input.