title: PHP - Build PDO Query Parameters from multiple checkbox form
body: <p>I am trying to build a PHP PDO query, based from a set of checkboxes that a user has selected on the previous page.</p>
  
  <p>So i have the following checkboxes in my form:</p>
  
  <pre><code>&lt;input type="checkbox" name="websites[]" value="one" id="one"&gt;
  &lt;input type="checkbox" name="websites[]" value="two" id="two"&gt;
  &lt;input type="checkbox" name="websites[]" value="three" id="three"&gt;
  </code></pre>
  
  <p>Once submitted i then want to build a pdo query and query parameters based from what checkboxes the user selected - they have to all be in the one query though. I know that any checked boxes will be stored in my $_POST['website'] array but how can i then take that and put them in the query? For example say the user selected one and three only, i then want to only select those fields from my database table:</p>
  
  <pre><code>$results = $_POST['websites'];
  
  $query = " 
      SELECT 
          one,
          three
      FROM 
          table
  "; 
  </code></pre>
  
  <p>How can i do the above?</p>