-2

HI I'm trying to figure out how a piece o sample code works but when I try and run it I get the above error. Kindly find line below

       if(!$_POST['user']    !$_POST['pass']){      //Affected Line 
         die('You did\'t fill in a required field.');   

   }

Thanks

1
  • !$_POST['user'] !$_POST['pass'] And what kind of fancy condition should that be? Commented Mar 31, 2015 at 18:12

1 Answer 1

2

You need a logical operator. I assume you want "or"

if(!$_POST['user'] || !$_POST['pass'])

I would personally check to see if they are empty:

if(empty($_POST['user']) || empty($_POST['pass']))
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks it worked almost wanted to ask why then after having a look it makes sense. Thanks again

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.