Jump to content


Photo

Ok This Is Now Annoying Me


  • Please log in to reply
2 replies to this topic

#1 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 04 June 2006 - 02:22 PM

the email works

$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);

but this does not:

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);
    }

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?
http://thewebsolutionprovider.com - A Solution For Everything Web!

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 04 June 2006 - 02:35 PM

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

#3 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 04 June 2006 - 02:39 PM

jesus so the problem was only that i indented the closing EOF, thats stupid!!! anyway thanks for your help
http://thewebsolutionprovider.com - A Solution For Everything Web!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users