Title: wordpress form filtering help
Last modified: August 19, 2016

---

# wordpress form filtering help

 *  [rjaus](https://wordpress.org/support/users/rjaus/)
 * (@rjaus)
 * [16 years ago](https://wordpress.org/support/topic/wordpress-form-filtering-help/)
 * Im trying to use a form to filter my posts by some custom fields.
    The issue 
   at the moment is that its only using the last filter query and ignoring the first
   two.
 * I havent done php for a year or two so I’ve forgotten everything.
    Any tips as
   to what I’m doing wrong, and if there is a better way to go about it, please 
   let me know.
 * If there is a plugin that would be suited to solved this issue please let me 
   know. I intended to use, WP-Smart-Sort-Premium, but its creator has gone awol
   and its no longer for sale…
 * Thank you.
 *     ```
       <?php
       /*
       Template Name: Events v2.0
       */
       ?>
   
       <?php
       //Filter links
   
       ?>
       <form action="" method="post">
       <input name="platform" value="Xbox 360" type="checkbox"
       id="commfees">Xbox 360 <br />
       <input name="platform" value="PC" type="checkbox"
       id="commfees">PC <br />
       <input name="game" value="Halo 3" type="checkbox"
       id="commfees">Halo 3 <br />
       <input name="game" value="Modern Warfare 2" type="checkbox"
       id="commfees">Modern Warfare 2 <br />
       <input name="prize" value=">=0" type="checkbox"
       id="commfees">$0 Prize <br />
       <input name="prize" value=">=1" type="checkbox"
       id="commfees">$1+ Prize <br />
       <input name="prize" value=">=1000" type="checkbox"
       id="commfees">$1000+ Prize <br />
   
       <input type="submit" value="Submit" />
   
       </form>
   
       <?php
       //setting filter values
       //platform
       if(isset($_POST['platform'])) {
       $var = $_POST['platform'];
       $platform = 'meta_key=Platform&meta_value='.$var.'';
       } else {
       $platform = 'meta_key=Platform';
       }
   
       //Game
       if(isset($_POST['game'])) {
       $var = $_POST['game'];
       $game = 'meta_key=Game&meta_value='.$var.'';
       } else {
       $game = 'meta_key=Game';
       }
   
       //Prize
       if(isset($_POST['prize'])) {
       $var = $_POST['prize'];
       $prize = 'meta_key=TotalPrizeValue&meta_value'.$var.'';
       } else {
       $prize = 'meta_key=TotalPrizeValue';
       }
   
       ?>
   
       <?php
       //query string
       $query = $platform .'&'. $game .'&'. $prize;
       query_posts($query);
   
        ?>
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [rjaus](https://wordpress.org/support/users/rjaus/)
 * (@rjaus)
 * [16 years ago](https://wordpress.org/support/topic/wordpress-form-filtering-help/#post-1438391)
 * I would also prefer to use links as opposed to a submit form. How should I do
   that? Issue is that I dont know where to point the links since Im using a template.
 * For example of what Im trying to achieve.
    [http://lookbook.nu/](http://lookbook.nu/)
   The **view **and **sex **filter options.

Viewing 1 replies (of 1 total)

The topic ‘wordpress form filtering help’ is closed to new replies.

 * 1 reply
 * 1 participant
 * Last reply from: [rjaus](https://wordpress.org/support/users/rjaus/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/wordpress-form-filtering-help/#post-1438391)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
