question on boolean AND

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!

Moderator: General Moderators

Post Reply
verymeanguy
Forum Newbie
Posts: 6
Joined: Sat Jul 19, 2008 5:40 am

question on boolean AND

Post by verymeanguy »

I have a code

Code: Select all

 
<?php
if(isset($_POST['name']))&&(isset($_POST['title']))&&(isset($_POST['text'])){
 
//blah blah blah...
 
}
But php says

Parse error: parse error, unexpected T_BOOLEAN_AND in c:\www\dbtest2.php on line 2

Why isn't the boolean AND (&&) not working here?
User avatar
EverLearning
Forum Contributor
Posts: 282
Joined: Sat Feb 23, 2008 3:49 am
Location: Niš, Serbia

Re: question on boolean AND

Post by EverLearning »

You need parenthesis around the whole statement. It should look like this:

Code: Select all

if ( (isset($_POST['name'])) && (isset($_POST['title'])) && (isset($_POST['text'])) ) {
 
//blah blah blah...
 
}
Post Reply