<p>You would just pass the other value (i.e. the section handle) in to that template as GET or POST parameter and in the search results template grab the paramater and use it, as in your code.</p>

<p>If using GET, the url you'd construct would be something like:</p>

<pre><code>http://whatever.com/search?query=blah&amp;sectionHandle=blah2
</code></pre>

<p>or with POST you might use e.g. a radio for the section option with the <code>name</code> being <code>sectionHandle</code> and the <code>value</code> being the actual handle of the chosen section.</p>

<p>Either way, in your template you then just:</p>

<pre><code>{% set sectionHandle = craft.request.getParam(sectionHandle) %}
{% paginate craft.entries.search(query).section(sectionHandle).limit(5) as entries %}
</code></pre>

CC BY-SA 3.0
2016-11-06T04:46:45.583Z
2016-11-06T04:46:45.583Z
Jeremy Daalder
<p>How would I enable search in a single section only?</p>

<p>I want my search results template to be used regardless of which search option is used. Ideally I'm looking to pass another value from my search form to the search results to do </p>

<p><code>{% paginate craft.entries.search(query).section(sectionPassedFromSearchForm).limit(5) as entries %}</code></p>

CC BY-SA 3.0
2016-11-05T23:36:54.200Z
http://craftcms.stackexchange.com/questions/8259/is-it-possible-to-exclude-multiple-sections-from-an-entry-search-query
Nutmeg
CC BY-SA 3.0
2016-11-06T04:19:31.813Z
Totally not following... obviously you can pass in the name of the section(s) you want to search, but I feel like I'm not understanding what you want to do.
Brad Bell
<search><sections><include>
Search in section only
# Search in section only

(Asked by: username_0 on 2016-11-05)

How would I enable search in a single section only?

I want my search results template to be used regardless of which search option is used. Ideally I'm looking to pass another value from my search form to the search results to do

`{% paginate craft.entries.search(query).section(sectionPassedFromSearchForm).limit(5) as entries %}`

**Tags:** search, sections, include

> **Comments:**
> **username_1**: http://craftcms.stackexchange.com/questions/8259/is-it-possible-to-exclude-multiple-sections-from-an-entry-search-query  
> **username_2**: Totally not following... obviously you can pass in the name of the section(s) you want to search, but I feel like I'm not understanding what you want to do.  

---

## 1 answers

### Answer by username_3 on 2016-11-06. Score: 1 | Accepted answer

You would just pass the other value (i.e. the section handle) in to that template as GET or POST parameter and in the search results template grab the paramater and use it, as in your code.
If using GET, the url you'd construct would be something like:
http://whatever.com/search?query=blah&sectionHandle=blah2

or with POST you might use e.g. a radio for the section option with the name being sectionHandle and the value being the actual handle of the chosen section.
Either way, in your template you then just:
{% set sectionHandle = craft.request.getParam(sectionHandle) %}
{% paginate craft.entries.search(query).section(sectionHandle).limit(5) as entries %}


---

