WordPress.org

Forums

How to pass form values (3 posts)

  1. mariostella
    Member
    Posted 4 years ago #

    Hello,
    Trying to filter my posts using query_posts. The posts should be filtered by category. I am using an array to only return posts that belong to all the categories at once. I got this part working.

    The problem arises when I implement a form with 4 checkboxes, one per each category, which the user should select, then submit and see a list of posts that only belong to the selected categories.

    The following is my not working code:
    http://wordpress.pastebin.com/EQSPiFc0

    Nothing is returned. The URL of the page does change including the selected checkbox value. When I try to echo $cats, I only get three commas, no category names, or values.

    I think I have a syntax error, but cannot get around it.

  2. superyetkin
    Member
    Posted 4 years ago #

    You need to call the PHP code before the form code.

    Donate if this helps you.

  3. mariostella
    Member
    Posted 4 years ago #

    That is of course not on the same file. I just posted everything on pastebin on the same document for easy of use. Does not help, thanks anyway.

Topic Closed

This topic has been closed to new replies.

About this Topic