开发者

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 wee开发者_如何转开发k 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.


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>
            ';


You're missing the $message .= after the closing } of the foreach

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜