PDA

View Full Version : Echoing more than one page with this script.



qwikad.com
03-27-2013, 05:32 PM
I want to show a text when the contact page is viewed. Just like it's showing below. It works just fine.






<?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?




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

Beverleyh
03-27-2013, 05:49 PM
I think this should do it: http://stackoverflow.com/questions/6284553/using-an-array-as-needles-in-strpos

qwikad.com
03-27-2013, 06:06 PM
I got it. I went ahead and did the long way and it's working:




<?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!';
}
?>