Jump to content

PHP HTML Email -- Can you include logic in message


Skor

Recommended Posts

I'm trying to make my HTML email a bit smarter and not include the ship to info if it is not filled out.  How do I make the code within the $message variable interpret the code:

 

Here's what I've coded:

 

if (empty($del_addr1)) {
    echo '<br>';
}else {
echo '
Ship To:<br>
$del_name<br>
$del_addr1<br>
$del_addr2<br>
$del_state<br>
$del_zip<br>
$del_country'<br><br>
}

 

Here's what displayed (the good news is that I fixed the error), obviously the variables are interpreted:

 

if (empty()) { echo '

'; }else { echo ' Ship To:

 

 

 

 

 

'

 

}

 

tried a couple of other things, but the results are worse.  Any suggestions...

well, actually you dont even need that, u could just do this...

 

<?php

$message = "This is my message to you";

if(!empty($ADDRESS_VAR)){

$message .= "Ship to: etc";

}

$message .= "Your friend Ben";

?>

 

 

Please excuse my absent-mindedness. I have been up too long, as usual.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.