title: Keep checkboxes checked after refresh within a Twig template- PHP
body: <p>I am attempting to create a search functionality that allows for filtering of results in such a way that reloads the page with new results each time you click an option on the clickbox, but also allows you to keep filtering using checkboxes that REMAIN CHECKED after reload.</p>
  
  <p>I have seen a solution for HTML that is something like:</p>
  
  <pre><code>&lt;input type="checkbox" name="txtCheck" value="your value" &lt;?php if(isset($_POST['txtCheck'])) echo "checked='checked'"; ?&gt;  /&gt;&lt;br /&gt;
  </code></pre>
  
  <p>But this does not work in twig. Does anyone know the solution for this within the twig template?</p>
  
  <p>Thank you in advance.</p>
  
  <p>A part of my form is below:</p>
  
  <pre><code>&lt;form action="{{ path ('person_search') }}" method="GET"&gt;
                  &lt;input type="checkbox" name="role" value="Applicant" onclick="this.form.submit()"&gt;Applicant&lt;br&gt;
  </code></pre>