I wish to display posts for multiple groups. I've produced a MULTISELECT drop lower of groups using code below:

<form method="get" action="<?php bloginfo('home');?>" >
    <select name="cat" multiple> 
     <option value=""><?php echo esc_attr(__('Please Select Your Choice')); ?></option> 
      $categories=  get_categories('show_count=0&orderby=name&echo=0&hierarchical=true&depth=1&taxonomy=category&exclude=1'); 
      foreach ($categories as $category) {

        $option = "<option value=$category->term_id>";
        $option .= ucfirst($category->cat_name);
        $option .= '</option>';
        echo $option;
<input type="submit" id="searchsubmit" value="Search" name="submit"/>   

Whenever i chooses several category, I can tell all cat ids in url like: http://abcd.com/?cat=7&cat=8&cat=9 However it shows only last category posts using archieve.php file. I wish to display all selected category posts around the page.

Thanks ahead of time.


$categoryids = array(3,6,8,19);

$args = array(
'numberposts'     => 20,
'category__in'    => $categoryids,
'orderby'         => 'post_date',
'order'           => 'DESC',
'post_type'       => 'photo',
'post_status'     => 'publish' );

$posts_array = get_posts( $args );


<!-- The carousel -->
<div class="scrolimageview">
    <div class="prvdiv"><a href="javascript: void(0)" id="gallery-prev"><img src="<?php bloginfo( 'template_url' ); ?>/images/prev.png" width="40"/></a></div>
    <div id="gallery-wrap">
        <ul style="width: 2068px; left: -188px;" id="gallery">
            <?php foreach ($posts_array as $postd): ?>
            $customd = get_post_custom($postd->ID);
            $attached_photo_filed = $customd["attached_photo"][0];
            $attached_photod = str_replace($postd->ID . '_', $postd->ID . '_thumb_',$attached_photo_filed);
            $imaged = $upload_dir['baseurl'] . '/photos/' . $attached_photod;
            <li><a href="<?php get_bloginfo('url')?>/photo-details?id=<?php echo $postd->ID; ?>"><img src="<?php echo $imaged; ?>" alt=""></a></li>
            <?php endforeach; ?>
    <div class="prvdiv1" style="float:right"><a href="javascript: void(0)" id="gallery-next"><img src="<?php bloginfo( 'template_url' ); ?>/images/next.png"/></a></div>

This code comes from among my project running live. Therefore it is 100% working, please tell me should you fall under any problem by using it.

    $categories = $_POST['category'];

<form action="" method="post">
    <select name="category[]" size="5" multiple="multiple">
        <option value="1">Red</option>
        <option value="2">Green</option>
        <option value="3">Blue</option>
        <option value="4">Yellow</option>
        <option value="5">Orange</option>
        <option value="6">Purple</option>
        <option value="7">Megento</option>
        <option value="8">Green</option>
        <option value="9">White</option>
        <option value="10">Black</option>
    <input type="submit" name="submit" value="Submit" />

Note utilization of [] in here -