title: How to get the market products from checkbox after clicking button?
body: <p>I have a list of products and every product has a checkbox. I want to get the market products when I mark them and click the button "Add To Cart". When I try to dump the products, there are no data in the array.</p>
  
  <p>Here is my Twig</p>
  
  <pre><code>{% extends 'base.html.twig' %}
  
  {% block body %}
      &lt;link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
      &lt;div style="text-align: center;"&gt;
          &lt;h2&gt;&lt;u&gt;Recent Products&lt;/u&gt;&lt;/h2&gt;
          &lt;hr&gt;
          &lt;form action="{{ path('cart_add') }}" method="post"&gt;
      {% for product in products %}
          &lt;div class="row"&gt;
              &lt;div class="col-md-7"&gt;
                      &lt;img src="/images/products/{{ product.image }}" alt="" width="300" height="250"&gt;
              &lt;/div&gt;
              &lt;div class="col-md-5"&gt;
                  &lt;h4&gt;&lt;b&gt;Name: &lt;/b&gt;{{ product.name }}&lt;/h4&gt;
                  &lt;h4&gt;&lt;b&gt;Description: &lt;/b&gt;&lt;/h4&gt;
                   Mark It &lt;input type="checkbox" value="{{ product.id }}" name="products[]"&gt;
                  &lt;p&gt;{{ product.description }}&lt;/p&gt;
                  &lt;a class="btn btn-primary" href="/products/details/{{ product.id }}"&gt;View Product &lt;span class="glyphicon glyphicon-chevron-right"&gt;&lt;/span&gt;&lt;/a&gt;
                  &lt;br&gt;
                  &lt;br&gt;
                  {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_EDITOR') %}
                  &lt;a href="/products/edit/{{ product.id }}" class="btn btn-default"&gt;Edit Product&lt;/a&gt;
                  &lt;a href="/products/delete/{{ product.id }}" class="btn btn-danger"&gt;Delete Product&lt;/a&gt;
                      {% endif %}
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;hr&gt;
      {% endfor %}
              &lt;a href="/cart/add" class="btn btn-default btn-sm"&gt;&lt;span class="glyphicon glyphicon-shopping-cart"&gt;&lt;/span&gt; Add To Cart&lt;/a&gt;
          &lt;/form&gt;
          &lt;div class="navigation"&gt;
              {{ knp_pagination_render(products) }}
          &lt;/div&gt;
      &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p>And the CartController</p>
  
  <pre><code>&lt;?php
  
  namespace AppBundle\Controller;
  
  use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use Symfony\Component\HttpFoundation\Request;
  
  class CartController extends Controller
  {
      /**
       * @Route("/cart/add", name="cart_add")
       */
      public function addToCartAction(Request $request)
      {
         var_dump($request-&gt;get('products', []));
         die();
      }
  
      /**
       * @Route("/cart/show", name="cart_list")
       */
      public function listCartAction()
      {   
          return $this-&gt;render('cart/cart.view.html.twig', [
              'products' =&gt; ...
          ]);
      }
  }
  </code></pre>