Jump to content

Recommended Posts

the email works

[code]
$recipient = "glen@gewebsitedevelopment.com";
        $title = "Testing Email";
        $body = <<<EOF
            <html>
                <body>
                    <font color='red'>HI THERE!</font>
                </body>
            </html>
        EOF;
        $headers = "From: glen@gewebsitedevelopment.com\n";
        $headers .= "Content-type: text/html";
        mail ($recipient,$title,$body,$headers);
[/code]

but this does not:

[code]
if ($_GET['action'] == "sendmail") {
        $recipient = "glen@gewebsitedevelopment.com";
        $title = "Testing Email";
        $body = <<<EOF
            <html>
                <body>
                    <font color='red'>HI THERE!</font>
                </body>
            </html>
        EOF;
        $headers = "From: glen@gewebsitedevelopment.com\n";
        $headers .= "Content-type: text/html";
        mail ($recipient,$title,$body,$headers);
    }
[/code]

i get this error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\program files\easyphp1-8\www\michaelt\index.php on line 51

To start with this code is nowhere near line 51, i have checked all the code and its fine. I just dont get why it works when is not inside the If() {} but does not inside the if

Any ideas?
Link to comment
https://forums.phpfreaks.com/topic/11156-ok-this-is-now-annoying-me/
Share on other sites

Technically, your first example shouldn't work either. As stated in the [a href=\"http://us2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc\" target=\"_blank\"]manual[/a]:
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]It is very important to note that the line with the closing identifier contains no other characters, except possibly a semicolon (;). That means especially that the identifier may not be indented, and there may not be any spaces or tabs after or before the semicolon. It's also important to realize that the first character before the closing identifier must be a newline as defined by your operating system.[/quote]

Ken
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.