title: Filtering MySQL Query using PHP using checkboxes
body: <p>I am working on a website for a hotel management company. On the portfolio page, I currently have a Google map with all of the hotels pinpointed and a table of the hotels all coming from a database.  However, I want a form with checkboxes that correspond to the hotel brands.  Selecting a checkbox will show only hotels that are that brand name.  I can figure out how to do it with just one brand selected, but not with multiple.</p>
  
  <p>This is the code for the form:</p>
  
  <pre><code>&lt;form&gt;
  &lt;div class="form-block"&gt;
  &lt;input type="checkbox" name="Courtyard" value="true" &lt;?php if (isset($_GET["Courtyard"])) { echo "checked"; } ?&gt; /&gt; Courtyard&lt;br /&gt;
  &lt;input type="checkbox" name="HolidayInnExpress" value="true" &lt;?php if (isset($_GET["HolidayInnExpress"])) { echo "checked"; } ?&gt; /&gt; Holiday Inn Express&lt;br /&gt;
  &lt;input type="checkbox" name="BestWestern" value="true" &lt;?php if (isset($_GET["BestWestern"])) { echo "checked"; } ?&gt; /&gt; Best Western&lt;br /&gt;
  &lt;/div&gt;
  &lt;div class="form-block"&gt;
  &lt;input type="checkbox" name="CrownePlaza" value="true" &lt;?php if (isset($_GET["CrownePlaza"])) { echo "checked"; } ?&gt; /&gt; Crowne Plaza&lt;br /&gt;
  &lt;input type="checkbox" name="HolidayInn" value="true" &lt;?php if (isset($_GET["HolidayInn"])) { echo "checked"; } ?&gt; /&gt; Holiday Inn&lt;br /&gt;
  &lt;input type="checkbox" name="SpringhillSuites" value="true" &lt;?php if (isset($_GET["SpringhillSuites"])) { echo "checked"; } ?&gt; /&gt; Springhill Suites&lt;br /&gt;
  &lt;/div&gt;
  &lt;div class="form-block"&gt;
  &lt;input type="checkbox" name="HamptonInn" value="true" &lt;?php if (isset($_GET["HamptonInn"])) { echo "checked"; } ?&gt; /&gt; Hampton Inn&lt;br /&gt;
  &lt;input type="checkbox" name="HomewoodSuites" value="true" &lt;?php if (isset($_GET["HomewoodSuites"])) { echo "checked"; } ?&gt; /&gt; Homewood Suites&lt;br /&gt;
  &lt;input type="checkbox" name="Independent" value="true" &lt;?php if (isset($_GET["Independent"])) { echo "checked"; } ?&gt; /&gt; Independent Properties&lt;br /&gt;
  &lt;/div&gt;
  &lt;button type="submit"&gt;Filter&lt;/button&gt;
  </code></pre>
  
  <p></p>
  
  <p>And the MySQL Query to display the table</p>
  
  <pre><code>    &lt;?php
  if (isset($_GET["BestWestern"])) {
    echo "Brand=\"Best Western\"";
  }
  $result = mysql_query("SELECT Name, City, State, Website FROM markers WHERE Brand LIKE '%' ORDER BY City");
  echo "&lt;table border='1'&gt;
  &lt;tr&gt;
      &lt;th&gt;Hotel Name&lt;/th&gt;
      &lt;th&gt;City&lt;/th&gt;
      &lt;th&gt;State&lt;/th&gt;
      &lt;th&gt;Website&lt;/th&gt;
  &lt;/tr&gt;";
  while($row = mysql_fetch_array($result)) {
      echo "&lt;tr&gt;";
      echo "&lt;td&gt;" . $row['Name'] . "&lt;/td&gt;";
      echo "&lt;td&gt;" . $row['City'] . "&lt;/td&gt;";
      echo "&lt;td&gt;" . $row['State'] . "&lt;/td&gt;";
      echo "&lt;td&gt;&lt;a href='" . $row['Website'] . "'&gt;Visit Website&lt;/a&gt;&lt;/td&gt;";
      echo "&lt;/tr&gt;";
  }
  echo "&lt;/table&gt;";
  ?&gt;
  </code></pre>
  
  <p>Any help would be appreciated.</p>