On Mon, Mar 28, 2011 at 7:06 AM, Hulf <ross@xxxxxxxxxxxxxx> wrote: > Hi, > > I am making and HTML email. I have 3 images to put in. Currently I have > > $body .=" > <table> > <tr> > <td><img src=\"image1.jpg\"></td> > </tr> > > <tr> > <td></td> > </tr> > </table> > "; > > > ideally I would like to have > > $myimage1 = "image1.jpg"; > $myimage2 = "image2.jpg"; > $myimage3 = "image3.jpg"; > > > and put them into the HTML body variable. I have tried escaping them in > every way i can think of, dots and slashes and the rest. Any ideas? Consider HEREDOC syntax. I'm not sure why you're doing your tables like that, but I'm sure you have your reasons. Also, I'm certain that hardcoding the image names like that is just for example, since it would be much easier to use an array or something similar (if it's not coming from a database or otherwise dynamically-generated). <?php $myimage1 = "image1.png"; $myimage2 = "image2.png"; $myimage3 = "image3.png"; $body .=<<<EOT <table> <tr> <td><img src="$myimage1"></td> </tr> <tr> <td> </td> </tr> <tr> <td><img src="$myimage2"></td> </tr> <tr> <td> </td> </tr> <tr> <td><img src="$myimage3"></td> </tr> <tr> <td> </td> </tr> </table> EOT; // This has to be at position one on the line, no matter what. ?> And, for good measure, the array way: <?php $images = array('image1.png','image2.png','image3.png'); echo "<table>\n"; foreach($images as $p => $v) { $body .=<<<EOT <tr> <td><img src="$v"></td> </tr> <tr> <td> </td> </tr> EOT; // Notice the blank line. That ensures a linebreak after the last </tr> } echo "</table>\n"; ?> -- </Daniel P. Brown> Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php