Skor Posted May 8, 2007 Share Posted May 8, 2007 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... Link to comment https://forums.phpfreaks.com/topic/50446-php-html-email-can-you-include-logic-in-message/ Share on other sites More sharing options...
benjaminbeazy Posted May 8, 2007 Share Posted May 8, 2007 why not make 2 versions of the message, 1 with ship info, 1 without based on whether or not address exists? Link to comment https://forums.phpfreaks.com/topic/50446-php-html-email-can-you-include-logic-in-message/#findComment-247859 Share on other sites More sharing options...
benjaminbeazy Posted May 8, 2007 Share Posted May 8, 2007 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. Link to comment https://forums.phpfreaks.com/topic/50446-php-html-email-can-you-include-logic-in-message/#findComment-247862 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.