-6

I'm trying to use and if statement in php and for some reason the 'and' logic operator (&&) isn't working. Here's the code:

if (isset($_POST['q1'])&&isset($_POST['q2'])&&isset($_POST['q3'])&&isset($_POST['q4'])&&isset($_POST['q5'])){
    echo "<h1>APRIL FOOLS! YOU JUST ANSWERED ALL THOSE QUESTIONS FOR NOTHING!!!!";
  } else{
    header("Location: http://www.jamesthistlewood.co.uk/chatter/free_premium.php?error=1");
  }

I have tried a couple of workarounds such as setting one of the values to False, but the statement is still not working. I just can't see what's wrong with it. Thanks in advance.

jumbot
  • 789
  • 5
  • 23
  • what errors are showing up? http://stackoverflow.com/questions/6575482/how-do-i-enable-error-reporting-in-php – dm03514 Mar 31 '14 at 17:22
  • 1
    "It doesn't work" is not a problem statement. Specify the behavior you want, and describe the behavior that you're actually getting. In other news, Programmer April Fools Jokes are so out of style nowadays. Consider wearing some broad lapels instead, or bell bottom jeans. – Robert Harvey Mar 31 '14 at 17:23
  • @Robert Harvey I have edited this question to make it more specific. – jumbot Apr 09 '14 at 10:08
  • This question is more specific now, I think it should be reopened. – jumbot Apr 09 '14 at 10:11

1 Answers1

4

use spaces surrounding the &&, since && attached to a symbol also means reference

Luis Masuelli
  • 11,492
  • 9
  • 44
  • 84