Jump to content

check if true


denoteone

Recommended Posts

I am trying to understand 

if(!mail("mail function variables")) { echo "this is true or sucessfull}else{ echo "this failed"]

is that how it works or is it check to see if it is false? I know this is a newbie question...but any help would be awesome.

Link to comment
Share on other sites

The ! before the function can pretty much be equated to == FALSE;

 

so

 

if (!function()) is the same as if (function() == FALSE)

 

Be careful though... ! checks for both FALSE and 0.. so if your function returns a numeric value, and there's a chance it might be 0, be sure to use

 

if (function() === FALSE)

Link to comment
Share on other sites

if(!mail('mrawers@******.com',$subject,$emailmessage,"FROM:$email",$headers)) {echo "error";}else{(html thank you page)} 

for some reason this keeps going into the  error part of the if statement but I am getting the email message in my inbox?

Link to comment
Share on other sites

$headers = "From: ".$email."\r\n";
$headers .= "Reply-To: mrawers@*******.com\r\n";
$headers .= "CC: sombodyelse@********.com\r\n";
     $headers .= "Content-type: text/html\r\n";  

  is this how I set the from header with a variable?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.