Link to home
Start Free TrialLog in
Avatar of morpheus3g
morpheus3g

asked on

PHP HERE DOCUMENT PROBLEM

Hi experts

i'm experiencing a problem using the here document method in php.

i wrote the following
<?php
php codes....

print <<<EOT
<script type='text/javascript'>window.opener.document.getElementById('lblImagesPreview').innerHTML='{$html}';window.close();</script>
EOT;

?>

it give me the error: "Parse error: parse error, unexpected T_SL in /server/www/other/technews/technews.it/modules/news/admin/index.php on line 1317"


ASKER CERTIFIED SOLUTION
Avatar of Diablo84
Diablo84

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think your syntax is a bit wrong.

This is how I use this type:
<?
$HELLO =<<<EOT
<HTML>
<HEAD><TITLE>TEST</TITLE></HEAD>
<BODY>My name is Geir.</BODY>
</HTML>
EOT;

print $HELLO;

-Geir
Again...
Also your syntax is right. Check Diablo84 suggestion.
I got the same error and thought the syntax was wrong, but I also had a space at the end.
(Fingers working to fast.)

-Geir
Avatar of morpheus3g
morpheus3g

ASKER

it was a problem of whitespace.. Thank you all :)