How to use in php The <<<EOB

Im trying to use EOB in my code to enter some htm code and its not recon zing the EOB; as the end ot the string  
$str  = <<<EOB   

	  		 <form id = "popup_form_{$emailAddress}"  action ="" method ="post" style="background-color:white; border:2px solid blue;padding:4px; width:250px; display :none; position:absolute"  onsubmit = "return false;">

			<input type ="hidden" name="flag" value = "no" >

			<input type="hidden" name ="email" value ="$emailAddress">

			<input type="submit" name="unSpamIt" value="UnSpamIt"  style="margin-right:15px;">

			<input type="button" value="Close" onclick="closePopup()"/>

		EOB;

Open in new window

Nura111Asked:
Who is Participating?
 
PragmatiCoderCommented:
Remove all the blank spaces before the final EOB;

Try:

$str  = <<<EOB   

                         <form id = "popup_form_{$emailAddress}"  action ="" method ="post" style="background-color:white; border:2px solid blue;padding:4px; width:250px; display :none; position:absolute"  onsubmit = "return false;">

                        <input type ="hidden" name="flag" value = "no" >

                        <input type="hidden" name ="email" value ="$emailAddress">

                        <input type="submit" name="unSpamIt" value="UnSpamIt"  style="margin-right:15px;">

                        <input type="button" value="Close" onclick="closePopup()"/>

EOB;

Open in new window

0
 
Dave BaldwinFixer of ProblemsCommented:
0
 
PragmatiCoderCommented:
Sorry... it's actually:

<?php
$str = <<<EOB
<form id = "popup_form_{$emailAddress}"  action ="" method ="post" style="background-color:white; border:2px solid blue;padding:4px; width:250px; display :none; position:absolute"  onsubmit = "return false;">
<input type ="hidden" name="flag" value = "no" >
<input type="hidden" name ="email" value ="$emailAddress">
<input type="submit" name="unSpamIt" value="UnSpamIt"  style="margin-right:15px;">
<input type="button" value="Close" onclick="closePopup()"/>
EOB;
?>

Open in new window

0
 
DerokorianCommented:
When using HEREDOC there may be NO whitespace on the line with the closing delimiter. Either before OR after.

Fix this as was mentioned by Pragmati and you shouldn't have a problem.
0
 
Ray PaseurCommented:
The HEREDOC man page is, in my experience, a little vague about how to use the notation.  I have found that the end-of-block line must start in column 1, as told on the page, but I have also found that it must be followed by a semi-colon and the semi-colon must be followed by a newline character.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.