How to organize a site search with additional criteria

How to organize a site search with additional criteria like this http://auto.drom.ru/
just show how to do it approximately thanks in advance


Answer 1, authority 100%

There is a table (offer):

id | mark | model    | year | price |
1  | BMW  | 3-Series | 2008 | ..... |

So you can make a request:

select * from offer where mark='BMW'

In order to make a request, you need a form:

<form action="script.php">
   :
   <select name="mark">
       <option value="">--</option>
       <option value="BMW">BMW</option>
   </select>
   :
   <select name="model">
       <option value="">--</option>
       <option value="BMW">BMW</option>
   </select>
     : <input type="text" name="year_from" />
   : <input type="text" name="year_to" />
   <input type="submit" value="" />
</form>

Actually, there is script.php

$sql = "select * from offer";
$where = array();
if (!empty($GET["mark"])) {
    $where[] = "mark='" . $GET["mark"] . "'"; 
}
if (!empty($GET["model"])) {
    $where[] = "model='" . $GET["model"] . "'";
}
//   
if (count($where)) {
    $sql .= ' where ' . implode(' and ', $where);
}
//      

Answer 2, authority 50%

You make a form in HTML, then after pressing the button you send all the selected parameters to the server, and there you process them well and create a request for the necessary fields with the necessary conditions.

What’s the problem?