10

I keep getting the following error:

Parse error: syntax error, unexpected T_SL in /home/a4999406/public_html/willingLog.html on line 70

on the following code (first line is line 70):

        echo <<<END 
<form action = "willingLog.html" method="post"><pre>
    First       <input type="text" name="first" />
    Last        <input type="text" name="last" />
    Email       <input type="text" name="email" />
    Username    <input type="text" name="user_name" />
                <input type="submit" value="AD RECORD" />
</pre></form>
END;

heredoc just doesn't seem to work. i've tried other examples.

following is by doctype heading. is there something wrong there?

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
4
  • Are there any funky invisible characters in there, or any syntax problems before that? Commented Jun 26, 2012 at 13:49
  • no invisible characters. no syntax issue above that I'm aware of. Commented Jun 26, 2012 at 13:51
  • T_SL stands for the << bitwise operator... weird. Commented Jun 26, 2012 at 13:54
  • Not too weird; one common reason for this error is a coder only uses two "<" instead of the requisite 3 for the HEREDOC delimiter. Hard to spot, too ;-) Commented Aug 19, 2015 at 19:09

2 Answers 2

24

Looking at the copy-paste, it looks like you have a space character after the word "END" on the first line:

'echo <<<END '

Try getting rid of the space character. Answer found by Googling. Source (link now dead): http://www.alexxoid.com/blog/dev/php-dev/php-parse-error-unexpected-t_sl.html

Sign up to request clarification or add additional context in comments.

Comments

0

Try:

echo <<<'END'
<form action = "willingLog.html" method="post"><pre>
    First       <input type="text" name="first" />
    Last        <input type="text" name="last" />
    Email       <input type="text" name="email" />
    Username    <input type="text" name="user_name" />
                <input type="submit" value="AD RECORD" />
</pre></form>
END;

4 Comments

In my case work correctly, can you say something more? Any errors?
And remember you MUST NO any white chars after echo <<<'END'
@Piotr Looks like that's the actual problem...!
removing a space after END did the trick, I think. Ran right into another bug, so I'll have to see.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.