Page 1 of 1

If statement in Php code

Posted: Tue Feb 03, 2009 9:31 am
by daisy4u721
How do i write a php code that emails an evaluation to me if Q8 is a Yes.
I tried this But it didn't work, any help please I'm totally new to this
if ($Q8) == Yes)
{
$sendMailTo .= "1234@yahoo.com";
}

Re: If statement in Php code

Posted: Tue Feb 03, 2009 9:58 am
by mickeyunderscore

Code: Select all

if ($Q8 == 'Yes')
{
     $sendMailTo .= "1234@yahoo.com";
}

Re: If statement in Php code

Posted: Tue Feb 03, 2009 10:00 am
by Skoalbasher
Even faster, make Q8 a bool

Code: Select all

 
if ($Q8)
{
     $sendMailTo .= "1234@yahoo.com";
}
 
Lol. It's a LOT less code.. 8O

Re: If statement in Php code

Posted: Tue Feb 03, 2009 10:10 am
by Ziq
This if statement will be generate an E_NOTICE error if $Q8 is undefined. Better use empty() or isset() functions.