ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Filtering entries

November 03, 2011 12:15pm

Subscribe [2]
  • #1 / Nov 03, 2011 12:15pm

    kachunchau

    14 posts

    I can get entries to filter using categories with dropdowns but I can’t seem to filter the entries using checkboxes.

    Anyone know why this is?

    <?php
    $EE =& get_instance();
    $fuel = $EE->input->post('fuel');
    
    if (isset($_POST)){
      $cats = ' category="';
      $cats .= $fuel;
      $cats .= '" ';
    }
    else{
      $cats="";
    }
    ?>
    
    <h2>Truck Explorer</h2>
    
    <p><form method="post" action="{path='search/index'}"></p>
    
    <p>   {exp:child_categories parent="16" child_categories_sort_direction="asc" show_empty="yes"}<br />
       {child_category_start}<br />
       <label>{child_category_name}<input type="checkbox" value="{child_category_name}" /></label><br />
       {child_category_end}<br />
       {/exp:child_categories}<br />
      <br />
      <input type="submit" value="Go!" /></p>
    
    <p></form></p>
    
    <p>{exp:channel:entries channel="products" dynamic="off" <?php echo $cats; ?>}<br />
    …<br />
    {/exp:channel:entries}

    Thanks,
    Ka-Chun

  • #2 / Nov 09, 2011 2:25pm

    grantmx

    1439 posts

    Your missing the name attribute on your checkbox.  Add that and it should work.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases