Re: empty() in email message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Bastien Koert" <phpster@xxxxxxxxx> wrote in message 
news:AANLkTimimT6h+G+zG4A_78wLS4Bu09zZSa3jVDujjD0x@xxxxxxxxxxxxxxxxx
On Mon, Dec 13, 2010 at 12:47 PM, Gary <gpaul@xxxxxxxxxxxxxxxx> wrote:
> 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
>
>
>
> __________ Information from ESET Smart Security, version of virus 
> signature database 5699 (20101213) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Less complication is better, reduce the code to the below. The empty
portion needs to be inside the parentheses. Also double quotes are
needed to make the vairable parse correctly into the value you want to
see

if (!empty($beefolives)) { echo "Order: beefolives $beefolives\n";}


-- 

Bastien

Bastien

Thank you for your response, and I agree, I like simpler.  Your script 
however did not work in the email message, it did work in another section 
where I echo to screen the information to the screen.

Does the echo command work in emails?

Thank you again.

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





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux