Trouble defining a variable in PHP?
Posted
by
Jake
on Stack Overflow
See other posts from Stack Overflow
or by Jake
Published on 2011-03-19T09:49:07Z
Indexed on
2011/03/19
16:10 UTC
Read the original article
Hit count: 288
Alright, so a content page uses this:
$tab = "Friends";
$title = "User Profile";
include '(the header file, with nav)';
And the header page has the code:
if ($tab == "Friends") {
echo '<li id="current">';
} else {
echo '<li>';
}
The problem is, that the if $tab == Friends
condition is never activated, and no other variables are carried from the the content page, to the header page.
Does anyone know what I'm doing wrong?
Update:
Alright, the problem seemed to disappear when I used ../scripts/filename.php
, and only occurred when I used a full URL?
Any ideas why?
© Stack Overflow or respective owner