Body: <p>I am writing my first post because I am stuck and cannot move forward. I need a filter that filters by &quot;Entries Field.&quot; The selection is done through a form + checkbox. I also get the ID of the entries through the selection. But passing it on is simply not working.</p>
  <p>For example, now the Checkbox with ID 364 &amp; 366 is selected.</p>
  <pre><code>{%- for i in 1..loopLength -%}
  
              {%- if craft.app.request.getParam('traffic[opt_2_'~ i ~']') is not empty -%}
              
                      {%- set i_value = '&quot;'~ craft.app.request.getParam('traffic[opt_2_'~ i ~']') ~'&quot;' -%}
                      {%- set traffic = traffic|merge([i_value]) -%}
  
              {%- endif -%}
              
      {%- endfor -%}
  </code></pre>
  <pre><code>{%- set filter = traffic|join(',') -%}
   =&gt; OUTPUT: 364, 366
  </code></pre>
  <p>My Query:</p>
  <pre><code>{% set output = craft.entries()
      .filter(['and', filter])    
          .all() 
  %}
  </code></pre>
  <p>** OUTPUT: NO Results **</p>
  <p>But when I manually enter the ID, the query works.</p>
  <pre><code>{% set output = craft.entries()
      .filter(['and', 364, 366])    
      .all() 
  %}
  </code></pre>
  <p>Output: 3 Results (in my Example)</p>
  <p>Otherwise, I don't know how to pass the selected checkboxes and their ID's.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-01-16T20:16:23.867Z
Comments.Text: this is the answer to my question:
  
  https://craftcms.stackexchange.com/questions/9200/filter-by-multiple-categories?rq=1
Comments.UserDisplayName: Tomka84
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-01-16T20:27:54.440Z
Comments.Text: Glad you found an answer. I think you may want to mark this primary question as answered as well.
Comments.UserDisplayName: 4midori
Tags: <entries><filter><query><entries-field>
Title: GET Checkbox Value to the Query (Entries Field)
ThreadText: # GET Checkbox Value to the Query (Entries Field)
  
  (Asked by: username_0 on 2023-01-12)
  
  I am writing my first post because I am stuck and cannot move forward. I need a filter that filters by "Entries Field." The selection is done through a form + checkbox. I also get the ID of the entries through the selection. But passing it on is simply not working.
  
  For example, now the Checkbox with ID 364 & 366 is selected.
  
  ```
  {%- for i in 1..loopLength -%}
  
              {%- if craft.app.request.getParam('traffic[opt_2_'~ i ~']') is not empty -%}
              
                      {%- set i_value = '"'~ craft.app.request.getParam('traffic[opt_2_'~ i ~']') ~'"' -%}
                      {%- set traffic = traffic|merge([i_value]) -%}
  
              {%- endif -%}
              
      {%- endfor -%}
  
  ```
  
  ```
  {%- set filter = traffic|join(',') -%}
   => OUTPUT: 364, 366
  
  ```
  
  My Query:
  
  ```
  {% set output = craft.entries()
      .filter(['and', filter])    
          .all() 
  %}
  
  ```
  
  \*\* OUTPUT: NO Results \*\*
  
  But when I manually enter the ID, the query works.
  
  ```
  {% set output = craft.entries()
      .filter(['and', 364, 366])    
      .all() 
  %}
  
  ```
  
  Output: 3 Results (in my Example)
  
  Otherwise, I don't know how to pass the selected checkboxes and their ID's.
  
  **Tags:** entries, filter, query, entries-field
  
  > **Comments:**
  > **username_0**: this is the answer to my question:  https://craftcms.stackexchange.com/questions/9200/filter-by-multiple-categories?rq=1  
  > **username_1**: Glad you found an answer. I think you may want to mark this primary question as answered as well.  
  
  ---
  
  ## 0 answers
  
  