title: PHP - Get all values that has been checked in checkbox and combine it in one array
body: <p>I had no problem on getting the values from HTML form but my problem is how to combine all values that I got in one array? </p>
  
  <p><strong>Example:</strong> </p>
  
  <p><code>Quantity[]</code> is separated from <code>CheckBox[]</code>. If the checkbox has been checked, only all values of it (Pizza ID, Name, Price and Quantity) should be transfer into one array.</p>
  
  <p><a href="https://i.stack.imgur.com/eJ7bR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eJ7bR.png" alt="enter image description here"></a></p>
  
  <p><strong>Snippet Code:</strong></p>
  
  <pre><code>&lt;tbody&gt;
      &lt;?php 
      $Row = 0;
      while ($Row = mysqli_fetch_array($Retrieval_Query, MYSQLI_ASSOC)){
          $pizzaID = $Row['pizzaID'];
          $pizzaName = $Row['pizzaName'];
          $pizzaPrice = $Row['pizzaPrice'];
      ?&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;?php echo $pizzaID; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $pizzaName; ?&gt; &lt;/td&gt;
          &lt;td&gt;&lt;?php echo $pizzaPrice; ?&gt; &lt;/td&gt;
          &lt;td&gt;&lt;input type = "number" name = "Quantities[]" placeholder = "0"/&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type = "checkbox" name = "CheckBox[]" value="&lt;?=$pizzaID?&gt;,&lt;?=$pizzaName?&gt;,&lt;?=$pizzaPrice?&gt;" placeholder = "0"/&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;?php } ?&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/form&gt;         
  &lt;button type="submit" form="form1" value="Atc" name="atc" class="btn btn-warning"&gt;Add to Cart&lt;/button&gt;
  </code></pre>
  
  <p>Back end:</p>
  
  <pre><code>&lt;?php
  $values = array();
  $quantities = array();
  
  if(isset($_POST['atc'])){
  
  //Operation to retrieve all values from HTML CheckBox[] and Quantities[] since they are separated inputs
  //And push all values that has been retrieved into same array
  foreach($_POST['CheckBox'] as $key =&gt; $value){
      array_push($values, $value);
  }
  foreach($_POST['Quantities'] as $key =&gt; $value){
      array_push($values, $value);
  }
  </code></pre>
  
  <p>Current Output: </p>
  
  <p><a href="https://i.stack.imgur.com/QaqHk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QaqHk.png" alt="enter image description here"></a></p>
  
  <p>Desired Output: </p>
  
  <p><a href="https://i.stack.imgur.com/0kTlk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0kTlk.png" alt="enter image description here"></a></p>
  
  <blockquote>
    <p>How to achieve the desired output? Is my technique on getting the values from HTML
    (2 Separated arrays) is right? How to make all values to be combine in
    just one array?</p>
  </blockquote>