如何使用PHP创建搜索按钮

I want to create search button to view items from database.

<form  method="post" name="searchdeals">
                <h5 class="display-5 text-left py-3">Find a favourite vehicle </h5>
                <div class="form-group select">
                    <select name="manufacturer_code" id="manufacturer_code" class="form-control" onchange="getState(this.value);">
                        <option selected>Select Brand</option>
                        <?php $ret="SELECT * FROM tbl_manufacturer";
                        $query= $dbh -> prepare($ret);
                        $query-> execute();
                        $results = $query -> fetchAll(PDO::FETCH_OBJ);
                        if($query -> rowCount() > 0)
                        {
                            foreach($results as $result)
                            {
                                ?>
                                <option value="<?php echo htmlentities($result->manufacturer_code);?>"><?php echo htmlentities($result->manufacturer_name);?></option>
                            <?php }} ?>
                    </select>
                </div>
                <div class="form-group select">
                    <select name="model_code" id="model_code" class="form-control">
                        <option selected>Select Model</option>
                    </select>
                </div>
                <div class="form-group">
                    <button type="submit" name="searchdeals" value="Filter" class="btn btn-block btn-warning"><i class="fa fa-search" aria-hidden="true"></i> Search Vehicle</button>
                </div>
            </form>

This is my form to search items. So can suggest to me how to create query and code to create search button.

I know to use LIKE OPERATOR in query, but i don't know to write the code

action.page

if(isset($_POST['searchdeals'])){

$valueToSearch = $_POST['model_code'];

$sql = "SELECT tbl_manufacturer.manufacturer_name, tbl_model.model_name, tbl_model.model_type, tbl_vehicle.*, tbl_company.comp_name
                                    FROM tbl_vehicle
                                    INNER JOIN tbl_company ON tbl_vehicle.comp_id = tbl_company.comp_id
                                    INNER JOIN tbl_model ON tbl_vehicle.model_code = tbl_model.model_code
                                    INNER JOIN tbl_manufacturer ON tbl_model.manufacturer_code = tbl_manufacturer.manufacturer_code";
$query = $dbh -> prepare($sql);
$query->execute();
$results=$query->fetchAll(PDO::FETCH_OBJ);

First you will need an action for your form like this:

<form  method="post" name="searchdeals" action="/action_page.php">

The action_page.php should then contain the code that uses your $_POST variables from your form to build your SELECT statement.

In action.php (assuming that this is the file that processes the submitted form), you should use the WHERE clause and the search term from the $_POST variable. In this case, you are posting model_code.

$sql = "SELECT tbl_manufacturer.manufacturer_name, tbl_model.model_name, tbl_model.model_type, tbl_vehicle.*, tbl_company.comp_name
                                    FROM tbl_vehicle
                                    INNER JOIN tbl_company ON tbl_vehicle.comp_id = tbl_company.comp_id
                                    INNER JOIN tbl_model ON tbl_vehicle.model_code = tbl_model.model_code
                                    INNER JOIN tbl_manufacturer ON tbl_model.manufacturer_code = tbl_manufacturer.manufacturer_code 
WHERE tbl_model.model_name like '%" . $_POST['model_code'] . "'%";

Not sure if that is the field you have to compare to but you get the idea.