I'm focusing on searching in wordpress i wish to search text in multiple groups. here's my code

<form method="post" action="<?php bloginfo('home');?>/?ptype=catsearch" >
    <input type="text" name="searchtext" size="40" />
        <h2><?php _e('Categories:'); ?></h2>
        <select name="category[]" multiple='multiple'> 
            <option value=""><?php echo esc_attr(__('Please Select Your Choice')); ?></option> 
                <?php $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"/>   

if this foms posts on catsearch.php file i takes all categoryids in array and make url see code below. if muliple groups selected it produces url like http://abcd.com/?cat=3&cat=7&cat=8&s=dasdasDS. Within this situation it search the written text only in last cat id. It overights the catids. I want if my search text present in any category then all posts ought to be displayed.

$categoryids = $_POST['category'];

            echo 'count is ---' .count($categoryids); 

                foreach($categoryids as $categoryid)
                    $cat.=  'cat='.$categoryid.'&';
                echo $cat = trim($cat, '&');
                echo '<br />';
                 $url .= '?'.$cat;

                echo 'searchtext---'. $_POST['searchtext'];
                echo '<br />';
                $url .= '&s='.$_POST['searchtext'];
<META http-equiv="refresh" content="1;URL=<?php echo get_bloginfo('url')."$url"; ?>">

When doing something similar to this


You're constantly changing the need for $_GET['cat']. Therefore it makes sense it would finish up being the final one - 8.

The syntax for querying multiple groups in wordpress is applying a comma