Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 909
  • Last Modified:

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

0
Nura111
Asked:
Nura111
1 Solution
 
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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now