title: Query building depending checkboxes selection
body: <p>I want to build a query form my database depending my checkboxes list.</p>
  
  <h1>My checkboxes:</h1>
  
  <pre><code>&lt;input type="checkbox" id="searchName" checked&gt; Name
  &lt;input type="checkbox" id="searchAddress"&gt; Address
  &lt;input type="checkbox" id="searchCompany"&gt; Company
  &lt;input type="checkbox" id="searchComments"&gt; Comments
  </code></pre>
  
  <h1>My PHP:</h1>
  
  <pre><code>$subQuery='';
  if($_POST['searchName']=='true')     { $subQuery .= " AND KDX_Name LIKE :KDX_SearchTerm"; }
  if($_POST['searchAddress']=='true')  { $subQuery .= " OR KDX_PostalAddress LIKE :KDX_SearchTerm"; }
  if($_POST['searchCompany']=='true')  { $subQuery .= " OR KDX_Company LIKE :KDX_SearchTerm"; }
  if($_POST['searchComments']=='true') { $subQuery .= " OR KDX_Comments LIKE :KDX_SearchTerm"; }
  </code></pre>
  
  <h1>My problem:</h1>
  
  <p>If the first checkbox is not checked, my query is not working cause it works with <code>OR</code> whereas it must start with <code>AND</code>.</p>
  
  <p>Could you please help ?</p>
  
  <p>Thanks.</p>