stockdalep Posted April 22, 2007 Share Posted April 22, 2007 Hi I have a HTML email and inside this I need to use a PHP variable that contains a string with html line breaks inside it. Can this be done. Thanks for any help. $message =' <html> <body bgcolor="#FFFFCC" text="#000000"> <div align="center"> <h1>Thank you for registering</h1> <br> <table width="385" border="0" cellspacing="2" cellpadding="2" height="74"> <tr bgcolor="#CC9900"> <td>"$items"</td> </tr> </table> </div> </body> </html> '; Link to comment https://forums.phpfreaks.com/topic/48116-solved-php-variable-in-email/ Share on other sites More sharing options...
paul2463 Posted April 22, 2007 Share Posted April 22, 2007 try this one, it works on my pages, <?php $message =" <html> <body bgcolor='#FFFFCC' text='#000000'> <div align='center'> <h1>Thank you for registering</h1> <table width='385' border='0' cellspacing='2' cellpadding='2' height='74'> <tr bgcolor='#CC9900'> <td> $items </td> </tr> </table> </div> </body> </html> "; ?> Link to comment https://forums.phpfreaks.com/topic/48116-solved-php-variable-in-email/#findComment-235147 Share on other sites More sharing options...
stockdalep Posted April 22, 2007 Author Share Posted April 22, 2007 Thanks for your time, God knows why it did not work for me first time around Link to comment https://forums.phpfreaks.com/topic/48116-solved-php-variable-in-email/#findComment-235153 Share on other sites More sharing options...
paul2463 Posted April 22, 2007 Share Posted April 22, 2007 I replaced you double quotes with single ones and vice versa, you have to get to know which way round the go if you wish to include HTML and variables Link to comment https://forums.phpfreaks.com/topic/48116-solved-php-variable-in-email/#findComment-235155 Share on other sites More sharing options...
V34 Posted April 22, 2007 Share Posted April 22, 2007 If you want your way with the single quote working, do this $message =' <html> <body bgcolor="#FFFFCC" text="#000000"> <div align="center"> <h1>Thank you for registering</h1> <table width="385" border="0" cellspacing="2" cellpadding="2" height="74"> <tr bgcolor="#CC9900"> <td>'.$items.'</td> </tr> </table> </div> </body> </html> '; Link to comment https://forums.phpfreaks.com/topic/48116-solved-php-variable-in-email/#findComment-235176 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.