title: Send different checkbox names from HTML to PHP in one form
body: <p>I'm relatively new to html and php. I'm trying to use values chosen in an html form in php.</p>
  
  <p>I've found lots of examples, how to read out the html <code>form</code> values in php when there is only one <code>form name</code> like <code>vehicle[]</code>.<br>
  But I would like to differentiate between types of <code>input</code> (vehicle or accommodation) and still have only one <code>submit button</code>. I've tried the following example, but it doesn't work ...</p>
  
  <p>The html snippet from test.html:</p>
  
  <pre><code>&lt;form action="form.php" method="POST"&gt;
    &lt;input type="checkbox" name="vehicle[]" value="Bike"&gt; I have a bike&lt;br&gt;
    &lt;input type="checkbox" name="vehicle[]" value="Car" checked&gt; I have a car&lt;br&gt;
    &lt;input type="checkbox" name="accomodation[]" value="House"&gt; I have a house&lt;br&gt;
    &lt;input type="checkbox" name="accomodation[]" value="Yurt"&gt; I have a yurt&lt;br&gt;
    &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The php snippet from form.php:</p>
  
  <pre><code>&lt;?php
    if(isset($_POST['submit']))
    {
      if(!empty($_POST['vehicle'])) 
      {
        foreach($_POST['vehicle'] as $vehiclecheck)
        {
          echo $vehiclecheck;
          echo "&lt;br&gt;";
        } 
      }
      if(!empty($_POST['accomodation'])) 
      {
        foreach($_POST['accomodation'] as $accomodationcheck)
        {
          echo $accomodationcheck;
          echo "&lt;br&gt;";
        } 
      }
  
    }
  ?&gt;
  </code></pre>
  
  <p>Is there a simple way to get what I want? Or do I need a workaround?</p>
  
  <p>Thanks!</p>