In the ancient times when things were easy, you just had to code a form in html and then your php would typically have a if($\_REQUEST['some\_value']) to handle the request. But now with Drupal, nothing is easy... Here is once more my latest battle to understand how Drupal thinks.

Context: I have a list of news (content type "news") shown on a page with paging system. Each news title links to the news details page. This works fine. There is a new requirement that each news must have one or more "tags". The goal is to show a list of checkboxes on top of the news list to allow the user to filter in/out news with the selected tags.

EDIT: After being defeated by Drupal's form I decided to completely bypass the Form API and generate my own fully flexible form.

There is only one thing remaining, Drupal is forcing some div wrappers around each of my input fields. I want to get rid of them (and stop Drupal to think at my place).

In my\_news\_list.tpl.php I coded:

```
<form action="" method="post"> <!-- recall same page on submit -->
<?php
foreach($tags as $tag){
    ?><input type="checkbox" name="tags[]" 
        value="<?php echo $tag['id'] ?>"
        onchange="form.submit();" 
        <?php if(isset($tag['checked'])){?>checked="checked"<?php }?> 
      /><?php echo $tag['value'] ?><?php
}
?>
</form>

```

Result(!):

```
<form action="" method="post">
    <div class=" ui-checkbox"> <!-- Why those div wrappers?! -->
        <input type="checkbox" name="tags[]" value="15" onchange="form.submit();">
    </div>
    Acquisitions
    <div class=" ui-checkbox">
        <input type="checkbox" name="tags[]" value="14" onchange="form.submit();">
    </div>
    Corporate
    <div class=" ui-checkbox">
        <input type="checkbox" name="tags[]" value="18" onchange="form.submit();">
    </div>
    Investor News
    <div class=" ui-checkbox">
        <input type="checkbox" name="tags[]" value="16" onchange="form.submit();">
    </div>
    Products and Services   
</form>

```
['https://drupal.stackexchange.com/questions/155403', 'https://drupal.stackexchange.com', 'https://drupal.stackexchange.com/users/39325/']
Drupal's Form API is complex but gives you lot of things: is secure, is extensible, is themeable. Indeed is more difficult than coding a simple HTML form, but with a simpel HTML form you have a simple functionality: just that simple HTML form.

Form API generates the form HTML element and handles the POST requests, and validate and submithandlers, you don't and you shouldn't code your own HTML form. 

I recommend you to read the [Drupal 6 Form API Quickstart Guide](https://www.drupal.org/node/751826). Drupal 7 form handling is pretty the same, but check the [Drupal 7 Form API Reference](http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7) and [Form API Internal Workflow Illustration](https://www.drupal.org/node/165104).

In the other hand you may prefer to use a module that address what you need without coding, that's a faceted search: [Facet API](https://www.drupal.org/project/facetapi). From its [documentation page](http://www.trellon.com/content/blog/apachesolr-and-facetapi):

> 
> Faceted search allows our search results to be filtered by defined
>  criteria like category, date, author, location, or anything else that
>  can come out of a field. We call these criteria facets. With facets,
>  you can narrow down your search more and more until you get to the
>  desired results.
> 
> 
>
The issue here is theme\_wrappers around your form elements.

// @see: <https://drupal.stackexchange.com/a/193587/58635>