Simple search using a single category in Craft CMS
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 %}