Page 1 of 1

Show depending on page

Posted: Wed Aug 11, 2010 11:22 pm
by mywwd
I'm trying to figure out to show a panel on a page based upon the url.

i've tried
if ($_SERVER['PHP_SELF'] == profile.php) {
echo "coding"
}

and it just shows it on everypage. I am using this in my header page for a menu

Re: Show depending on page

Posted: Thu Aug 12, 2010 12:53 am
by shawngoldw
I am not sure if this is a complete solution, but the proper way to compare strings is:

Code: Select all

strcmp($str1, $str2) == 0
If it equals 0 then the strings are the same


Shawn

Re: Show depending on page

Posted: Thu Aug 12, 2010 1:16 am
by mywwd
$str1 = $_SERVER['PHP_SELF'];
$str2 = "users.php?id=" . $_GET[id];
if (strcmp($str1, $str2) == 0) {
echo "test<br>";
echo $_SERVER['PHP_SELF'];
}

Doing it like this still shows the information all the time on every page