Title: php elseif statement
Last modified: August 20, 2016

---

# php elseif statement

 *  Resolved [jrcollins](https://wordpress.org/support/users/jrcollins/)
 * (@jrcollins)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-elseif-statement/)
 * I have a search widget installed and want to output a simple line of text with
   two possible variations on the search results page. The text varies depending
   on the search form inputs.
    I have tried the following code (in my page template
   file) but with no success.
 *     ```
       <?php
       if($_GET['easelSearch']=="?idx=Books&kw" || $_GET['easelSearch']=="?idx=KindleStore&kw"){
         echo "<h5>Click on book’s title for individual item’s details, or on image for full product information on the Amazon website.</h5>";
       } elseif ($GET['easelSearch']=="?idx=All&item"){
         echo "<h5>Click on image for full product information on the Amazon website</h5><hr>";
       }
       ?>
       ```
   
 * Actually, I have no idea if I’m even close to getting this right.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Rajan Vijayan](https://wordpress.org/support/users/rajanit2000/)
 * (@rajanit2000)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-elseif-statement/#post-3444300)
 * Your code have a mistakes. $_GET does not support & , ? symbols
 *  Thread Starter [jrcollins](https://wordpress.org/support/users/jrcollins/)
 * (@jrcollins)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-elseif-statement/#post-3444305)
 * Hey thanks Rajan, I got it sorted now. I used the following code:
 *     ```
       <?php
       if($_GET['idx']=="Books" || $_GET['idx']=="KindleStore"){
         echo "<h5>Click on book’s title for individual item’s details, or on image for full product information on the Amazon website.</h5><hr>";
       } elseif ($_GET['idx']=="All"){
         echo "<h5>Click on image for full product information on the Amazon website</h5><hr>";
       }
       ?>
       ```
   
 *  [Rajan Vijayan](https://wordpress.org/support/users/rajanit2000/)
 * (@rajanit2000)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-elseif-statement/#post-3444314)
 * Welcome jrcollins.,
 * If is possible close this thread
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [13 years, 4 months ago](https://wordpress.org/support/topic/php-elseif-statement/#post-3444315)
 * [@rajan](https://wordpress.org/support/users/rajan/) Resolved threads should 
   be _resolved_, not closed.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘php elseif statement’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/php-elseif-statement/#post-3444315)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
