title: How to include specific column elements in MySQL Select clause based on user's input in a PHP/HTML form?
body: <p>I've a simple Inset List (jQuery Mobile) of several items with a Flip switch, Drop down, check box and Slider elements.</p>
  
  <p>I have wrapped this Inset List inside a HTML Form.</p>
  
  <pre><code>&lt;div data-role="fieldcontain"&gt;
        &lt;ul data-role="listview" data-inset="true"&gt;
          &lt;li data-role="list-divider"&gt; Inhouse capabilities &lt;/li&gt;
          &lt;li&gt; &lt;label for="flip-b"&gt;Project Manager&lt;/label&gt;
              &lt;select name="slider" id="flip-b" data-role="slider"&gt;
                  &lt;option value="no"&gt;No&lt;/option&gt;
                  &lt;option value="yes"&gt;Yes&lt;/option&gt;
              &lt;/select&gt;
           &lt;/li&gt;   
          &lt;li&gt; &lt;label for="flip-b"&gt;Site Supervisor&lt;/label&gt;
              &lt;select name="slider" id="flip-b" data-role="slider"&gt;
                  &lt;option value="no"&gt;No&lt;/option&gt;
                  &lt;option value="yes"&gt;Yes&lt;/option&gt;
              &lt;/select&gt;
          &lt;/li&gt;
           &lt;li&gt;&lt;label for="flip-b"&gt;Architect&lt;/label&gt;
              &lt;select name="slider" id="flip-b" data-role="slider"&gt;
                  &lt;option value="no"&gt;No&lt;/option&gt;
                  &lt;option value="yes"&gt;Yes&lt;/option&gt;
              &lt;/select&gt;
            &lt;/li&gt;
          &lt;li&gt;&lt;label for="flip-b"&gt;Builderworks&lt;/label&gt;
              &lt;select name="slider" id="flip-b" data-role="slider"&gt;
                  &lt;option value="no"&gt;No&lt;/option&gt;
                  &lt;option value="yes"&gt;Yes&lt;/option&gt;
              &lt;/select&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;label for="flip-b"&gt;Electrical&lt;/label&gt;
              &lt;select name="slider" id="flip-b" data-role="slider"&gt;
                  &lt;option value="no"&gt;No&lt;/option&gt;
                  &lt;option value="yes"&gt;Yes&lt;/option&gt;
              &lt;/select&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;label for="flip-b"&gt;Mechanical&lt;/label&gt;
              &lt;select name="slider" id="flip-b" data-role="slider"&gt;
                  &lt;option value="no"&gt;No&lt;/option&gt;
                  &lt;option value="yes"&gt;Yes&lt;/option&gt;
              &lt;/select&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;label for="flip-b"&gt;Hydraulics&lt;/label&gt;
              &lt;select name="slider" id="flip-b" data-role="slider"&gt;
                  &lt;option value="no"&gt;No&lt;/option&gt;
                  &lt;option value="yes"&gt;Yes&lt;/option&gt;
              &lt;/select&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;label for="flip-b"&gt;Joinery&lt;/label&gt;
              &lt;select name="slider" id="flip-b" data-role="slider"&gt;
                  &lt;option value="no"&gt;No&lt;/option&gt;
                  &lt;option value="yes"&gt;Yes&lt;/option&gt;
              &lt;/select&gt;
            &lt;/li&gt;
            &lt;li&gt; 
                  &lt;label for="select-choice-1" class="select"&gt;Main Location:&lt;/label&gt;
                     &lt;select name="select-choice-1" id="select-choice-1"&gt;
                        &lt;option value="NSW"&gt;NSW&lt;/option&gt;
                        &lt;option value="ACT"&gt;ACT&lt;/option&gt;
                        &lt;option value="VIC"&gt;VIC&lt;/option&gt;
                        &lt;option value="SA"&gt;SA&lt;/option&gt;
                        &lt;option value="QLD"&gt;QLD&lt;/option&gt;
                        &lt;option value="NT"&gt;NT&lt;/option&gt;
                        &lt;option value="WA"&gt;WA&lt;/option&gt;
                        &lt;option value="TAS"&gt;TAS&lt;/option&gt;
                      &lt;/select&gt;                     
            &lt;/li&gt; &lt;!-- Select Menus: Main Location--&gt;
  
              &lt;li&gt;     
                  &lt;div  data-role="fieldcontain"&gt;
                  &lt;fieldset data-role="controlgroup"&gt;
                      &lt;legend&gt;CBA Reference&lt;/legend&gt;
                      &lt;input type="checkbox" name="checkbox-1a" id="checkbox-1a" class="custom" /&gt;
                      &lt;label for="checkbox-1a"&gt;Commercial&lt;/label&gt;
                      &lt;input type="checkbox" name="checkbox-2a" id="checkbox-2a" class="custom" /&gt;
                      &lt;label for="checkbox-2a"&gt;Retail&lt;/label&gt;
                  &lt;/fieldset&gt;
                  &lt;/div&gt;
              &lt;/li&gt;                          
   &lt;/ul&gt;             
      &lt;/div&gt; &lt;!-- End of Field Contain div tag --&gt;   
   &lt;a href="#additionalinfo" data-role="button" data-inline="true" data-iconpos="left" data-theme="b"&gt;Additional Info&lt;/a&gt;
  &lt;a href="./search2.html" rel="external" data-ajax="false" data-role="button" data-inline="true" data-icon="search" data-iconpos="left" data-theme="e"&gt;Search&lt;/a&gt;
  </code></pre>
  
  <p> 
      `</p>
  
  <p>I want to know, how I can include only the elements the user selected in my SQL query.</p>
  
  <p>Lets say, User wants to find the Electrical workers in QLD, then he will select Yes for Electrical and QLD as Main Location and the other items he would not touch.</p>
  
  <p>Now, how can I include only those two values in the select clause.</p>
  
  <p>Say, Select Electrical, Main Location from table where Main location='QLD'.</p>
  
  <p>I used POST method to gather users input. I use PHP, MySQL for this project.</p>
  
  <p>Any ideas on how to achieve this?</p>