title: Symfony 4 - How to pass parameters from form to controller
body: <p>I am in troubles while trying to pass parameters from my form to my controller.</p>
  
  <p>What I am trying to implement is a list of choices that will permit to display a list of users depending on parameters (role, ban ...).</p>
  
  <p>The problem is I think that I don't get the parameter after submit to have my request in index.
  Could the problem be that I reder the same form in the same function before and after submitting ?  </p>
  
  <p>I tried putting href/onclick/ tags on my options but it didn't work.</p>
  
  <pre><code>index.html.twig
  
  &lt;form class="form-group" action="{{ path('user_index') }}"&gt;
              &lt;table class="table"&gt;
                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;select class="custom-select"&gt;
                              &lt;option selected=""&gt;Which users to you want to see ?&lt;/option&gt;
                              &lt;option value="1"&gt;All&lt;/option&gt;
                              &lt;option value="2"&gt;Students&lt;/option&gt;
                              &lt;option value="3"&gt;Teachers&lt;/option&gt;
                              &lt;option value="4"&gt;Admins&lt;/option&gt;
                              &lt;option value="5"&gt;Super Admin&lt;/option&gt;
                              &lt;option value="6"&gt;Banned&lt;/option&gt;
                              &lt;option value="7"&gt;Unbanned&lt;/option&gt;
                          &lt;/select&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;input type="submit" value="Submit"&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/form&gt;
  </code></pre>
  
  <pre><code>UserController.php
  
  /**
       * Requires ADMIN_ROLE
       *
       * @Route("/", name="user_index", methods={"GET"})
       */
      public function index(Request $request): Response
      {
          $this-&gt;denyAccessUnlessGranted('ROLE_ADMIN');
  
          $ban = true;
  
          // trying to get the value of the option in form ?
          $value = $request-&gt;request-&gt;get('value');
  
          switch ($value){
              case 1 :
                  $users = $this-&gt;getDoctrine()
                      -&gt;getRepository(User::class)
                      -&gt;findAll();
                  break;
              case 6 :
                  $users = $this-&gt;getDoctrine()
                      -&gt;getRepository(User::class)
                      -&gt;findByBan($ban);
                  break;
              case 7 :
                  $ban = false;
                  $users = $this-&gt;getDoctrine()
                      -&gt;getRepository(User::class)
                      -&gt;findByBan($ban);
                  break;
              default:
                  $users = $this-&gt;getDoctrine()
                      -&gt;getRepository(User::class)
                      -&gt;findAll();
                  break;
          }
  
          return $this-&gt;render('user/index.html.twig', [
              'title' =&gt; 'User Index',
              'headtitle' =&gt; 'View all the users list',
              'users' =&gt; $users,
          ]);
      }
  </code></pre>