title: PHP get checkbox value's separated by comma's
body: <p>I have a contact form with a couple of checkboxes. 
  Whenever i submit the form I would like the selected value's to be printed separated by comma's. </p>
  
  <pre><code>&lt;form  method="POST"&gt;
    &lt;input type="checkbox" id="product1" name="product1" value="12"&gt;
    &lt;input type="checkbox" id="product2" name="product1" value="13"&gt;
    &lt;input type="checkbox" id="product3" name="product1" value="14"&gt;
    &lt;button type="submit"&gt;Subscribe&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I'm using this form. Lets say product 1 and 2 are selected. Then it should print 12,13 &lt; 
  What is the best way to do this? Is it even possible? </p>
  
  <p>Thanks in advance. </p>
  
  <p>USE CASE:</p>
  
  <p>So I thought it was useful to post why I need this.</p>
  
  <p>Later when I'm able to get the values I will do something like this: </p>
  
  <p><code>header("Location: http://test.com/$myvalues");</code></p>
  
  <p>So this link can be <code>test.com/12,13</code> after the user submits the form.</p>
  
  <p>Not working:</p>
  
  <p>So im using this code</p>
  
  <pre><code>&lt;?php
    if(isset($_POST['product'])){
      $values =  implode(',',$_POST['product']);
      // header("Location: https://test.com/?add-to-cart=$values");
    }
    ?&gt;
  </code></pre>
  
  <p>Whenever i click on the submit button, it takes me to a page that doesnt exist. So i get a 404 page. Even with the header location commented off. 
  The header location doesnt seem to work at all. </p>