• Resolved jrcollins

    (@jrcollins)


    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)
  • Your code have a mistakes. $_GET does not support & , ? symbols

    Thread Starter jrcollins

    (@jrcollins)

    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>";
    }
    ?>

    Welcome jrcollins.,

    If is possible close this thread

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    @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.