Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6909195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:39:32+00:00 2026-05-27T08:39:32+00:00

I want to display posts for multiple categories. I have created a MULTISELECT drop

  • 0

I want to display posts for multiple categories. I have created a MULTISELECT drop down of all categories 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> 
     <?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;
      }
     ?>
    </select>
<input type="submit" id="searchsubmit" value="Search" name="submit"/>   
</form>

Whenever i selects more than one category, I can see all cat ids in url like: http://abcd.com/?cat=7&cat=8&cat=9 But it displays only last category posts using archieve.php file. I want to display all selected category posts on the page.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:39:33+00:00Added an answer on May 27, 2026 at 8:39 am
    <?php 
    if(isset($_POST['submit']))
    {
        $categories = $_POST['category'];
    
        print_r($categories);   
    }
    ?>
    <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>
        </select>
        <input type="submit" name="submit" value="Submit" />
    </form>
    

    Note use of [] in here –

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On my blog, I want to display the all the posts from the last
i want to display some information in a listview using the GridView. i have
i have a table and it display all the record in the table using
I have a simple quiz application and I want display a nice timer /
I'm creating multiple form retrieving data from jquery. after that i want to work
I edited my wordpress page to only display posts from certain categories. This works,
If I want to display the recent X amount of recent posts\comments on the
I have an Umbraco based blog and I want to display the top 10
I want to display the most recent posts from my phpbb3 forum on my
I am creating a tumblr theme and I dont want to display posts with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.