Re: If statement being ignored by PHP

From: Date: Fri, 30 Jun 2000 14:38:35 +0000
Subject: Re: If statement being ignored by PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-4036@lists.php.net to get a copy of this message
In article <395CB16B.41A990A8@openconcept.on.ca>, mike@openconcept.on.ca (Mike Gifford) wrote: > mail a message. Can someone tell me why my if statement is being > ignored and why the message is posted directly before I have entered > anything into the form? > > > if ($post="yes"): > > mail("$recipient <$remail>", "$sender has sent you a card", > $message,"From: $semail \nReply-To: $semail\nX-Mailer: PHP3"); > echo "Your card number $idnumber has been sent to $recipient."; > endif; > > endif; if ($post = "yes") is always true, because the '=' is the assignment operator. You've just set $post to be "yes". What you probably want is if ($post == "yes") The double '=' is the equality test. Jerry

« previous php.general (#4036) next »