Re: putting variables in a variable
| From: | Al | Date: | Sat, 26 Mar 2011 15:46:59 +0000 |
| Subject: | Re: putting variables in a variable | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-312070@lists.php.net to get a copy of this message | ||
On 3/25/2011 10:01 PM, David Robley wrote:
Hulf wrote:I'd use: $imgArray= array("image1.jpg","image2.jpg","image3.jpg"); $body.= "<table>\n"; foreach($imgArray as $image){ $body .= "<tr><td><img src=\"$myimage1\" /></td></tr>\n; } $body .= "</table>\n\n"; Watch the <img src=\"$myimage1\" />. <img> is an open tag; so end it with " />" and it'll be XHTML ready.Hi, I am making and HTML email. I have 3 images to put in. Currently I have $body .=" <table> <tr>Did you try $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? Ross<td><img src=\"$myimage1\"></td></tr> <tr><td></td></tr> </table> "; It helps us help you if you can give examples of what you have tried and how it didn't work as you expected. Cheers