I have this form to get user input: 

```
<form method="post" action="do_search.php">
    <select name="stat">
        <option value="-">No StatTrak</option>
        <option value="ST">StatTrak</option>
    </select>
        <input type="text" name="search" id="search_box" class="search_box" placeholder="Bayonet / Blue Steel (Factory New)"></br>
        <input type="submit" value="Find item!" class="search_button" /><br />
</form>

```

The query works and searches the second column (itemname) for matches. Now I want to make the select box filter out the results by using the first column.

First column only contains either "ST" or "-".

Here is my query:

```
$search=$_POST['search'];
$stat=$_POST['stat'];
$query = $pdo->prepare("SELECT itemname, itemprice, itemupdate, itemstat FROM pricedata WHERE itemname Like ? ORDER BY itemprice DESC LIMIT 15");
$query->bindValue(1, "%$search%", PDO::PARAM_STR);
$query->execute();

```

Basically I need something like: 

```
...FROM pricedata where itemname LIKE $Searchbox AND itemstat LIKE $Selectbox...

```

I am new to php and I made this query using some tutorials. I understand most of it, but I don't understand how the values are "prepared".

This part is hard to understand for me:

```
$query->bindValue(1, "%$search%", PDO::PARAM_STR);

```

What would be the proper way to make the select box give an additional variable to the query, so it only shows results that match the searchbox AND have either "ST" or "-" in the first column.

Thanks in advance, i appreciate any help! :)

Edit - Here is a part of my Database:
[![enter image description here](https://i.stack.imgur.com/JjqYk.jpg)](https://i.stack.imgur.com/JjqYk.jpg)

---

**For Dimlucas:** 

```
$query = $pdo->prepare("SELECT itemname, itemprice, itemupdate, itemstat FROM pricedata WHERE itemname Like ? AND itemstat=? ORDER BY itemprice DESC LIMIT 15");
$query->bindValue(1, "%$search%", PDO::PARAM_STR);
$query->bindValue(2, $stat);
$query->execute();

```

This query (the first one you posted just said "nothing found", but it WOULD do the right thing, if it worked, since it includes both user inputs (select box AND search bar).

```
SELECT itemname, itemprice, itemupdate, itemstat FROM pricedata WHERE itemname Like 'Karambit' AND itemstat='ST' ORDER BY itemprice DESC LIMIT 15

```

I replaced the first one with this one to test, if there is any problem finding the right match. It found the right match, but this one doesn't include any placeholders or user inputs, so I guess, that there is a probleme between taking the user input and giving it to the query to use.

Right now I have this as query and to print out results -> <http://pastebin.com/xMf4jCgH>

I tried to add $search and $stat in front of the table. It prints out the search string but Neither a "-" or a "ST", which is the input from the select box. So the problem is, that the user input doesn't even reach the query.

Do you have any idea?