using 'or' operator not working for menu
- by John Wilkes
In my code here, I have a CSS class called "active" which I use if the $_GET['page'] == tutorials, php, mysql, etc...
The problem is, even if the 'page' variable is not equal to any of these values, the Tutorials button in this case is still active for some reason.
Any ideas why this would be happening?
Am I using the 'or' (||) operand incorrectly?
<?php if($_GET['page'] == 'tutorials' || 'php' || 'mysql' || 'html' || 'css' || 'js') { ?>
<li class="active"> <?php } else { ?> <li> <?php } ?>
<a href="index.php?page=tutorials">Tutorials</a>
<ul>
<li><a href="index.php?page=php">PHP</a></li>
<li><a href="index.php?page=mysql">MySQL</a></li>
<li><a href="index.php?page=html">HTML</a></li>
<li><a href="index.php?page=css">CSS</a></li>
<li><a href="index.php?page=js">JS</a></li>
</ul>
</li>