Search code examples
phphtmlfrontendvisual-web-developer

image tag not working in php html, if i write another variable in that image working. please find the attached code 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>
";

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?


Solution

  • 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>";