Answers.Body: <p>I might be missing something, but your code is missing a <code>{% for entry in entries %}</code> loop wrapped around your <code>&lt;div&gt;</code>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-28T08:52:39.780Z
Answers.LastActivityDate: 2017-04-28T08:52:39.780Z
Answers.UserDisplayName: Mike Pierce
Body: <p>I have four category groups (Position, State, Status, Denomination). I am trying to create a search form so all four categories can be utilized together or individually.</p>
  
  <p>Here is what I have for my form:</p>
  
  <pre><code>&lt;form action="{{ url('ministry-jobs/results') }}"&gt;
  
  &lt;input type="search" name="query" placeholder="What are you looking for?" style="width: 100%;"&gt;
  
  &lt;select name="position[]"&gt;
    &lt;option value="" selected&gt;-- Select Position --&lt;/option&gt;
    {% set positions = craft.categories.group('position') %}
    {% for position in positions %}
    &lt;option value="{{ position.slug }}"&gt;{{ position.title }}&lt;/option&gt;
    {% endfor %}
  &lt;/select&gt;
  
  &lt;select name="state[]"&gt;
    &lt;option value="" selected&gt;-- Select State --&lt;/option&gt;
    {% set states = craft.categories.group('state') %}
    {% for state in states %}
    &lt;option value="{{ state.slug }}"&gt;{{ state.title }}&lt;/option&gt;
    {% endfor %}
  &lt;/select&gt;
  
  &lt;select name="status[]"&gt;
    &lt;option value="" selected&gt;-- Select Status --&lt;/option&gt;
    {% set statuses = craft.categories.group('status') %}
    {% for status in statuses %}
    &lt;option value="{{ status.slug }}"&gt;{{ status.title }}&lt;/option&gt;
    {% endfor %}
  &lt;/select&gt;
  
  &lt;select name="denomination[]"&gt;
    &lt;option value="" selected&gt;-- Select Denomination --&lt;/option&gt;
    {% set denominations = craft.categories.group('denomination') %}
    {% for denomination in denominations %}
    &lt;option value="{{ denomination.slug }}"&gt;{{ denomination.title }}&lt;/option&gt;
    {% endfor %}
  &lt;/select&gt;
  
  &lt;div class=""&gt;
    &lt;input type="submit" value="Search"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>And here is what I have on Results Page:</p>
  
  <pre><code>{% set query = craft.request.getParam('q') %}
  {% set position = craft.request.getParam('position') %}
  {% set state = craft.request.getParam('state') %}
  {% set status = craft.request.getParam('status') %}
  
  {% set homeGrownParam = craft.request.getParam('homeGrown') %}
  {% set preparedProduceParam = craft.request.getParam('preparedProduce') %}
  {% set redTractorParam = craft.request.getParam('redTractor') %}
  
  {% set positionCat = position ? craft.categories.group('position').slug(position).find() %}
  {% set stateCat = state ? craft.categories.group('state').slug(state).find() %}
  {% set statusCat = status ? craft.categories.group('status').slug(status).find() %}
  
  {% set positionParam = positionCat ? {targetElement: ['and']|merge(positionCat)} %}
  {% set stateParam = stateCat ? {targetElement: ['and']|merge(stateCat)} %}
  {% set statusParam = statusCat ? {targetElement: ['and']|merge(statusCat)} %}
  
  {% set relationParams = [positionParam, stateParam, statusParam]|filter %}
  
  {% set entries = craft.entries({
      section: 'ministryJobs',
      relatedTo: relationParams ? ['and']|merge(relationParams) : null,
      search: query,
      homeGrown: homeGrownParam,
      preparedProduce: preparedProduceParam,
      redTractor: redTractorParam
  }) %}
  
  &lt;div class="{{ cycle(['job-display-white', 'job-display-grey'], loop.index0) }}"&gt;
  
      &lt;a href="{{ entry.url }}"&gt;
          &lt;div class="col-1 post-data"&gt;{{ entry.postDate.format("m/d/y") }}&lt;/div&gt;
          &lt;div class="col-2 post-data job-position"&gt;{{ entry.position }}&lt;/div&gt;
          &lt;div class="col-3 post-data"&gt;{{ entry.church }}&lt;/div&gt;
          &lt;div class="col-4 post-data"&gt;{{ entry.city }}&lt;/div&gt;
          &lt;div class="col-5 post-data"&gt;{{ entry.state }}&lt;/div&gt;
          &lt;div style="clear: both;"&gt;&lt;/div&gt;
      &lt;/a&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>I am getting no results. I am not sure what I am doing wrong. Any help is greatly appreciated.</p>
  
Tags: <templating>
Title: Searching Multiple Categories in Craft CMS
ThreadText: # Searching Multiple Categories in Craft CMS
  
  (Asked by: username_0 on 2017-04-27)
  
  I have four category groups (Position, State, Status, Denomination). I am trying to create a search form so all four categories can be utilized together or individually.
  
  Here is what I have for my form:
  
  ```
  <form action="{{ url('ministry-jobs/results') }}">
  
  <input type="search" name="query" placeholder="What are you looking for?" style="width: 100%;">
  
  <select name="position[]">
    <option value="" selected>-- Select Position --</option>
    {% set positions = craft.categories.group('position') %}
    {% for position in positions %}
    <option value="{{ position.slug }}">{{ position.title }}</option>
    {% endfor %}
  </select>
  
  <select name="state[]">
    <option value="" selected>-- Select State --</option>
    {% set states = craft.categories.group('state') %}
    {% for state in states %}
    <option value="{{ state.slug }}">{{ state.title }}</option>
    {% endfor %}
  </select>
  
  <select name="status[]">
    <option value="" selected>-- Select Status --</option>
    {% set statuses = craft.categories.group('status') %}
    {% for status in statuses %}
    <option value="{{ status.slug }}">{{ status.title }}</option>
    {% endfor %}
  </select>
  
  <select name="denomination[]">
    <option value="" selected>-- Select Denomination --</option>
    {% set denominations = craft.categories.group('denomination') %}
    {% for denomination in denominations %}
    <option value="{{ denomination.slug }}">{{ denomination.title }}</option>
    {% endfor %}
  </select>
  
  <div class="">
    <input type="submit" value="Search">
  </div>
  
  ```
  
  And here is what I have on Results Page:
  
  ```
  {% set query = craft.request.getParam('q') %}
  {% set position = craft.request.getParam('position') %}
  {% set state = craft.request.getParam('state') %}
  {% set status = craft.request.getParam('status') %}
  
  {% set homeGrownParam = craft.request.getParam('homeGrown') %}
  {% set preparedProduceParam = craft.request.getParam('preparedProduce') %}
  {% set redTractorParam = craft.request.getParam('redTractor') %}
  
  {% set positionCat = position ? craft.categories.group('position').slug(position).find() %}
  {% set stateCat = state ? craft.categories.group('state').slug(state).find() %}
  {% set statusCat = status ? craft.categories.group('status').slug(status).find() %}
  
  {% set positionParam = positionCat ? {targetElement: ['and']|merge(positionCat)} %}
  {% set stateParam = stateCat ? {targetElement: ['and']|merge(stateCat)} %}
  {% set statusParam = statusCat ? {targetElement: ['and']|merge(statusCat)} %}
  
  {% set relationParams = [positionParam, stateParam, statusParam]|filter %}
  
  {% set entries = craft.entries({
      section: 'ministryJobs',
      relatedTo: relationParams ? ['and']|merge(relationParams) : null,
      search: query,
      homeGrown: homeGrownParam,
      preparedProduce: preparedProduceParam,
      redTractor: redTractorParam
  }) %}
  
  <div class="{{ cycle(['job-display-white', 'job-display-grey'], loop.index0) }}">
  
      <a href="{{ entry.url }}">
          <div class="col-1 post-data">{{ entry.postDate.format("m/d/y") }}</div>
          <div class="col-2 post-data job-position">{{ entry.position }}</div>
          <div class="col-3 post-data">{{ entry.church }}</div>
          <div class="col-4 post-data">{{ entry.city }}</div>
          <div class="col-5 post-data">{{ entry.state }}</div>
          <div style="clear: both;"></div>
      </a>
  
  </div>
  
  ```
  
  I am getting no results. I am not sure what I am doing wrong. Any help is greatly appreciated.
  
  **Tags:** templating
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-04-28. Score: 0 | Accepted answer
  
  I might be missing something, but your code is missing a `{% for entry in entries %}` loop wrapped around your `<div>`.
  
  
  ---
  
  