Re: If statement being ignored by PHP
| From: | Jurian | Date: | Fri, 30 Jun 2000 14:38:45 +0000 |
| Subject: | Re: If statement being ignored by PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-4035@lists.php.net to get a copy of this message | ||
well, probably doesn't work cause that if ( ) : thingie makes no sense?
it's not:
if (condition):
code;
endif;
but:
if (condition) {
code;
}
also, get rid of the endif; stuff, cause that's not PHP either
At 10:40 30-6-2000 -0400, Mike Gifford wrote:
Hello, I've got an a small script in which I would like to be able to first verify that a field isn't empty and if that field isn't empty, I'd like it to print a form. If the posting from the form is yes, I'd like to 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? Here's the script: if ($semail!=""):change to: if ($semail != "") {
$post=""; echo "<form method=\"POST\" action=\"send.php3\">"; echo "<input type=\"radio\" value=\"yes\" NAME=\"post\">Yes, please send my card!"; echo "<input type=\"radio\" value=\"no\" NAME=\"post\">No, I will try again."; echo "<input type=\"submit\" value=\"Submit\"></form><br>"; if ($post="yes"):change to: 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;change to: }
endif;change to: }
Thanks! Mike --Mike A. Gifford OpenConcept ConsultingMike@OpenConcept.On.Ca Http://www.OpenConcept.On.Ca Web Design, Hosting, Graphic Design & Site PromotionFeatured Site --> Http://WTOAction.Org-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net