What I am trying to do is echo out based on the $_GET[‘page’] variable however its echoing this out for all of my navigation menu’s. How can I only have it use the page I am on? This is only the php part of it, the actual html code goes below each line however for simplicity I did not include it
<?php if($_GET['page'] == 'user_edit' || 'NULL'){ echo "<li class=\"current\">"; } else{ echo "<li>";} ?>
<?php if($_GET['page'] == 'manage' || 'add' || 'ftp'){ echo "<li class=\"current\">"; } else{ echo "<li>";} ?>
<?php if($_GET['page'] == 'bugs' || 'support' || 'notifications'){ echo "<li class=\"current\">"; } else{ echo "<li>";} ?>
It does not work like this. Your conditions are evaluated as:
Note the grouping above. All three are separate expressions. It does not mean “if
$varequals ‘foo’, ‘bar’ or ‘baz'”, it means “if$varequals ‘foo’ is true or ‘bar’ is true or ‘baz’ is true”.And
'bar'is alwaystrue.You need:
or