Re: empty() in email message
| From: | Gary | Date: | Tue, 14 Dec 2010 04:53:06 +0000 |
| Subject: | Re: empty() in email message | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-310018@lists.php.net to get a copy of this message | ||
"Andre Polykanine" <andre@oire.org> wrote in message
news:1110253876.20101214025042@oire.org...
> Hello Gary,
>
> Try using this:
> if (!empty($beefolives)) $msg.="Order: beef olives";
> or:
> $msg.=empty($beefolives)? "": "Order: beef olives";
>
> --
> With best regards from Ukraine,
> Andre
> Skype: Francophile
> Twitter: http://twitter.com/m_elensule
> Facebook: http://facebook.com/menelion
>
> ----- Original message -----
> From: Gary <gpaul@paulgdesigns.com>
> To: php-general@lists.php.net <php-general@lists.php.net>
> Date: Monday, December 13, 2010, 7:47:49 PM
> Subject: [PHP] empty() in email message
>
> I have an email message
>
> $msg = 'Name: $fname ' . ' $lname\n'
> . "Phone: $phone\n"
> . "Email: $email\n"
>
> and it works fine, however in this message there are about 30 variables
> that
> are being called...as such
>
> . "Order: beefschnitzel $beefschnitzel\n"
> . "Order: beefstrips $beefstrips\n"
> . "Order: cheesesausage $cheesesausage\n"
> . "Order: crumbedsausage $crumbedsausage\n"
> . "Order: chucksteak $chucksteak\n"
> . "Order: cornedbeef $cornedbeef\n"
> . "Order: dicedsteak $dicedsteak\n"
> . "Order: filletmignon $filletmignon\n"
>
> I want to only send the message if the submitter enters an amount in the
> form for the corresponding variable, instead of having a bunch of empty
> messages. So I have been trying to use the empty() function as such:
>
> . if empty($beefolives){''} elseif (isset($beefolives)) { 'Order:
> beefolives
> $beefolives\n'}
>
> But I am getting the error
>
> Parse error: syntax error, unexpected T_IF
>
> Can someone point me in the right direction?
>
> Thank you
> --
> Gary
>
>
Andre
That looks good, I will give that a try in the morning, thank you for your
help.
Gary
__________ Information from ESET Smart Security, version of virus signature database 5700 (20101213)
__________
The message was checked by ESET Smart Security.
http://www.eset.com