I'm trying to set up a basic MySQL LIKE search using two search fields. I wan't to have it so it's multiple optional search fields e.g. if(isset($_POST['city']) || isset($_POST['name'])) I'm not sure how to do it with a HTML<select name=""><option value="">... seeing as you can't define a name for each <select> field. So, first... How do you make a MySQL <select>search where each yields it's own result? Then, how would I properly query multiple search options? Below I'm using a "text box" + <select> search.
<input type="text" name="type" />
<select name="location">
<option value="Chicago">Chicago</option>
<option value="New York">New York</option>
</select>
<input type="submit" value="Search" />
MySQL:
$query = "SELECT
name, type, description, location, zip_code, phone_number
FROM search
WHERE type LIKE '%$type%'
OR location LIKE 'Chicago'
OR location LIKE 'New York'
";
I know I'm doing something wrong on the OR clauses. I"m not totally sure how to properly do the <option> / <select> HTML form tag search query.