PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
For some reason this code is always returning true (and echoing) even when I make a request like index.php?audio=2 on the page. What am I doing wrong here?
<?php
if ($_GET['audio'] != "0" || $_GET['audio'] != "1" || $_GET['audio'] != "2")
{echo 'if you requested "index.php?audio=2" then this message should not appear';}?>
Replace the || with &&, essentially you are saying if any one of those pass let them in. Therefore, when ?audio=2 is checked against if ($_GET['audio']==1) then it evaluates true.