PDA

View Full Version : Writing IF statements into a variable...


iamdan356160
02-27-2011, 06:44 AM
Hi,
Im trying to prewrite an email message that will be inserted into a HTML editor window. This is what I've come up with so far...

<?php
$MessageBody = "Hi ".$row_rs_refdetails['User_FirstName'].",
<br />
My names ".$row_rs_mydetails['User_FirstName']." ".$row_rs_mydetails['User_SecondName']. " and I&acute;m your referral on the site
<br />
<br />"
?>

And so ($MessageBody) renders as...

Hi Bob,
<br />
My names Dan Weaver and I'm your referral on the site.
<br />
<br />

But I'm having trouble figuring out how to write if statements into the $MessageBody variable! How would I need to rewrite the following code to include it in the code above??

This is just a quick message to see how you're getting on with the Viral Review Bot. My user management software shows that you're currently on the <?php if ($row_rs_refdetails['User_Progress'] == 'premium.php') { ?>Premium Upgrade page<?php } ?><?php if ($row_rs_refdetails['User_Progress'] == 'affproducts.php') { ?>Reviewed Products Bundle page<?php } ?><?php if ($row_rs_refdetails['User_Progress'] == 'upsellbundle.php') { ?>Personal Coaching page<?php } ?><?php if ($row_rs_refdetails['User_Progress'] == 'home.php') { ?>Control Panel<?php } ?>?

Thank you in advance!

Dan

Jason Byrnes
02-28-2011, 07:26 AM
alll of the output should be concatinated to the $MessageBody variable:


<?php
$MessageBody .= "This is just a quick message to see how you're getting on with the Viral Review Bot. My user management software shows that you're currently on the";
if ($row_rs_refdetails['User_Progress'] == 'premium.php') $MessageBody .= " Premium Upgrade page";

if ($row_rs_refdetails['User_Progress'] == 'affproducts.php') $MessageBody .= " Reviewed Products Bundle page";
if ($row_rs_refdetails['User_Progress'] == 'upsellbundle.php') $MessageBody .= " Personal Coaching page";
if ($row_rs_refdetails['User_Progress'] == 'home.php') $MessageBody .= " Control Panel";
}
?>