Multiple categories form with checkboxes
-
Hi, it’s me again … ??
Here’s the situation:
I have, let’s say, 5 categories:“Stores”, “Museums”, “Garages”, “Sports”, “Towns”, and the last one – “Towns” is hidden (excluded) from cateogries menus.
I would like to, when I click on “Stores”, and I get archive page with posts in that category, on the top of that page is form with checkboxes te select child categories of “Towns”.
So, I would like that I, while on “Stores” archive page,can check one or few boxes with towns, and when clicks “Submit” to display posts that are in – “Stores” AND “New York” AND “Washington” (in other words – stores located in N.Y and Washington).
Here my code, so far (which doesn’t work, off course):<?php $cat_ID = $cat; ?> <form action="<?php query_posts(array('category__and' => array($cat_ID,array($categories->term_id)))); ?>"> <?php $categories=get_categories('child_of=5&hide_empty=0'); foreach($categories as $category) { echo "<input type='checkbox' name='mychecky' value='$category->term_id' />"; echo $category->cat_name; echo '<br />'; } ?> <INPUT TYPE=SUBMIT VALUE="submit"> </form> <?php while (have_posts()) : the_post(); ?> ... etc (the loop here ..)
Any help is deeply appretiated …
- The topic ‘Multiple categories form with checkboxes’ is closed to new replies.