Q:

html inside a php email

Can someone please explain why the ' . $ending . '! doesn't work the same way as ' . $salutation . '! in the following code?  What is it that I am missing?
                    $salutation = 'Greetings, ' . $cname;
                $ending = 'Thank you for using HammerPins, ' . $cname;

                $subject = 'Hammerpins.net Alert: Newly Added Bowling Tournaments';
                $message = '
                <html>
                <body>
                    <p>' . $salutation . '!</p>
                    <p>New tournaments were added to the HammerPins database this week in the following counties:</p>';
                    foreach ($user_array as $single_user_item) {
                        $message .= "$single_user_item[link]";
                    }'
                    <p>' . $ending . '!</p>
                </body>
                </html>
                ';

Thanks for your help with this.

A:

Because you ended the original statement right before your foreach loop. Try this instead:
                $salutation = 'Greetings, ' . $cname;
            $ending = 'Thank you for using HammerPins, ' . $cname;

            $subject = 'Hammerpins.net Alert: Newly Added Bowling Tournaments';
            $message = '
            <html>
            <body>
                <p>' . $salutation . '!</p>
                <p>New tournaments were added to the HammerPins database this week in the following counties:</p>';
                foreach ($user_array as $single_user_item) {
                    $message .= "$single_user_item[link]";
                }
                $message .= '<p>' . $ending . '!</p>
            </body>
            </html>
            ';

