Simple search using a single category in Craft CMS I am relatively new to Craft and I am having a little trouble understanding how to build a simple search which will allow me to have dropdown of my categories which will return the selected category and return results on /products/results page.

I have a category called "Products" and have the following categories "Fruit", "Vegetables", "Dairy", "Herbs", "Eggs", and "Misc".  I would like to have these categories in a dropdown menu which would allow visitor to select the category they would like to view.  I also need it to show all product when they select "All Products", with "All Products" being the default value.

Thank you for your help.
You can build you categories dropdown using the craft.categories tag.  Your Form submission field will end up looking something like this in HTML:

&lt;form action="search/results" method="get"&gt;
    &lt;select name="querySlug"&gt;
      &lt;option value="*"&gt;All products&lt;/option&gt;
      &lt;option value="fruit"&gt;Fruit&lt;/option&gt;
      &lt;option value="vegetables"&gt;Vegetables&lt;/option&gt;
      &lt;option value="dairy"&gt;Dairy&lt;/option&gt;
    &lt;/select&gt;
    &lt;input type="submit" value="Search"&gt;
&lt;/form&gt;


Your results page will behave similar to the example results page in the Craft docs, except, instead of passing your query to a craft.entries.search() tag, you'll want to pass it to the craft.categories.slug() tag and then hand off the CategoryModel you get back to the craft.entries tag using relatedTo():

{% set querySlug = craft.request.getParam('querySlug') %}
{% set category = craft.categories.group('productCategories').slug(querySlug) %}
{% set entries = craft.entries.section('products').relatedTo(category) %}


All categories are returned by default, so you just have to handle that in a conditional if somebody selects that option.  Here is a simple way you could do that:

{% set querySlug = craft.request.getParam('querySlug') %}
{% set category = craft.categories.group('productCategories').slug(querySlug) %}

{% if querySlug == "*" %}   
    {% set products = craft.entries.section('products') %}
{% else %}
    {% set products = craft.entries.section('products').relatedTo(category) %}
{% endif %}