I have this issue with php. What I want to do, is to have a search engine with three filters: search by title, description and price. This is my index html.
<form style="text-align:center;" method="get" action="search.php">
<label>
Search
<input type="text"name="keywords" autocomplete="off">
</label>
<input type="submit" value="Search"><br>
</form>
By using action method I'm calling search.php file.
if(isset($_GET['keywords'])) {
$keywords = $db->escape_string($_GET['keywords']);
$query = $db->query("SELECT title, description, price FROM products WHERE title LIKE '%{$keywords}%' OR description LIKE '%{$keywords}%' OR price LIKE '%{$keywords}%'");
}
Not it combines all of the results to one, because I'm using same variable keywords. The problem now is that I don't have a filter, because I'm not sure how to create it. Maybe I would like to have a dropdown select with those three options: title, description, price. But I don't know how to make my php code to see which one is selected. Or maybe there is a better solution for my idea? Should I use different variables like keyword was or what?