2
$message .= "
    <html>
        <head>
        <title>Copy of your form submission</title>
        </head>
        <body>
            <table>
                <tr>
                    <td>
                     "<img src="images/assets/thank_you.png" alt="Thank You" />"
                    </td>                
                </tr>
            </table>
        </div>
    </html>
";

if i write

$message .= same image link above ;

it's working. but when i'm writing the image tag into html like above, then not working. can anyone can help?

3 Answers3

3

Need not to use quotes " around the img tag. Also use single quotes ' within the double quotes " used. Like below:

$message .= "
    <html>
        <head>
        <title>Copy of your form submission</title>
        </head>
        <body>
            <table>
                <tr>
                    <td>
                     <img src='images/assets/thank_you.png' alt = 'Thank You' />
                    </td>                
                </tr>
            </table>
        </div>
    </html>";
Lovepreet Singh
  • 4,792
  • 1
  • 18
  • 36
1

you can try like

$message .= "
  <html>
    <head>
    <title>Copy of your form submission</title>
    </head>
    <body>
        <table>
            <tr>
                <td>
                 <img src='images/assets/thank_you.png' alt='Thank You'/>
                </td>                
            </tr>
        </table>
      </div>
   </html>
";

and when using image link with php

$message .= "
<html>
<head>
<title>Copy of your form submission</title>
</head>
<body>
    <table>
        <tr>
            <td>
             <img src=".$imagelink." alt='Thank You'/>
            </td>                
        </tr>
    </table>
  </div>
 </html>
";
1

What i understand from your code is issue with the concate in the string there could be 3 possible ways to correct it

First:

$message .= "
    <html>
        <head>
        <title>Copy of your form submission</title>
        </head>
        <body>
            <table>
                <tr>
                    <td>
                     <img src='images/assets/thank_you.png' alt='Thank You' />
                    </td>                
                </tr>
            </table>
        </div>
    </html>
";

Second:

$message .= "
    <html>
        <head>
        <title>Copy of your form submission</title>
        </head>
        <body>
            <table>
                <tr>
                    <td>";
                     $message .='<img src="images/assets/thank_you.png" alt="Thank You" />';
                    $message .="</td>                
                </tr>
            </table>
        </div>
    </html>
";

Third:

$message .= "
        <html>
            <head>
            <title>Copy of your form submission</title>
            </head>
            <body>
                <table>
                    <tr>
                        <td>
                         <img src=\"images/assets/thank_you.png\" alt=\"Thank You\" />
                        </td>                
                    </tr>
                </table>
            </div>
        </html>
    ";
Veerendra
  • 2,562
  • 2
  • 22
  • 39