Results 1 to 3 of 3

Thread: Echoing more than one page with this script.

  1. #1
    Join Date
    Oct 2012
    Posts
    159
    Thanks
    21
    Thanked 1 Time in 1 Post

    Default Echoing more than one page with this script.

    I want to show a text when the contact page is viewed. Just like it's showing below. It works just fine.


    Code:
    
    <?php
    
    $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    
    if (false !== strpos($url,'contact')) {
        echo 'Thank you for checking us out!';
    }
    ?>
    My question is how do I add more pages to the script? I want to add about and help pages to it. When I do something like this, it doesn't show the pages. How would you add multiple choices to this script?

    Code:
    <?php
    
    $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    
    if (false !== strpos($url,'contact' && 'about' && 'help')) {
        echo 'Thank you for checking us out!';
    }
    ?>
    Thank you.

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    2,345
    Thanks
    16
    Thanked 406 Times in 404 Posts
    Blog Entries
    18

    Default

    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    Oct 2012
    Posts
    159
    Thanks
    21
    Thanked 1 Time in 1 Post

    Default

    I got it. I went ahead and did the long way and it's working:

    Code:
    <?php
    
    $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    
    if (false !== strpos($url,'contact') || false !== strpos($url,'help') || false !== strpos($url,'about')) {
        echo 'Thank you for checking us out!';
    }
    ?>

Similar Threads

  1. Resolved echoing strings and variables
    By keyboard in forum PHP
    Replies: 9
    Last Post: 06-02-2012, 10:16 PM
  2. ECHOing: Losing contents of
    By marain in forum PHP
    Replies: 3
    Last Post: 05-13-2012, 09:40 PM
  3. if statement echoing both 'if' and 'else'?
    By liamallan in forum PHP
    Replies: 14
    Last Post: 04-25-2010, 09:29 PM
  4. Replies: 1
    Last Post: 12-11-2008, 11:25 AM
  5. Echoing information from MySQL
    By big-dog1965 in forum PHP
    Replies: 0
    Last Post: 12-14-2007, 07:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •