If statement being ignored by PHP
| From: | Mike Gifford | Date: | Fri, 30 Jun 2000 14:40:43 +0000 |
| Subject: | If statement being ignored by PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-4033@lists.php.net to get a copy of this message | ||
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!=""):
$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"):
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;
Thanks!
Mike
--
Mike A. Gifford OpenConcept Consulting
Mike@OpenConcept.On.Ca Http://www.OpenConcept.On.Ca
Web Design, Hosting, Graphic Design & Site Promotion
Featured Site --> Http://WTOAction.Org