?
Solved

What do these tages mean in php code or usage;  <<< EOFORMSTR  and later , EOFORMSTR    I have seen them in various example code from a PHP book.

Posted on 2006-07-08
14
Medium Priority
?
571 Views
Last Modified: 2010-08-05
I realize that when I remove them from the Zend editor the rest of the
code seems ok ; except that when I do a debug I get then a 'parse error'
on line 35 where the <TABLE> tag begins; "what am I missing here"????

<?php
/****************************
 * Change email form page.*
 ***************************/

require_once('includes/emailpass_funcs.inc');
require_once('includes/login_funcs.inc');
if (!user_isloggedin()) {
      header("location: index.php");
 }
 
  if ($_POST['submit'] == "Change my confirmation") {
        $worked = user_change_email();
        if ($worked == 1) {
              $feedback_str = "<P class=\"errormess\">A confirmation" .
              "email has been sent to you.<\P>";
        } else {
              $feedback_str = "<P class=\"errormess\">$feedback<\P>";
    }
      
    }
      
   
    // ------------
    // DISPLAY FORM
    // ------------
   
    include_once('includes/header_footer.php');
    site_header('Change Email');
   
    // Superglobals don't work with heredoc
    $php_self = $_SERVER['PHP_SELF'];
   
    $form_str = <<< EOFORMSTR
    <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 ALIGN=CENTER
      WIDTH=621>
    <TR>
    <TD ROWSPAN=2><IMG WIDTH=15 HEIGHT=1
      SRC=../images/spacer.gif></TD>
    <TD WIDTH=606 HEIGHT=1><IMG WIDTH=606 HEIGHT=1
      SRC=../images/spacer.gif></TD>
    </TR>
    <TR>
     <TD>
    $feedback_str
    <P CLASS=left><B>Change your email address</B><BR>
    A confirmation email will be sent to you. <BR>
    <FORM ACTION="$php_self" METHOD="POST">
    <B>Password</B><BR>
    <INPUT TYPE="password" NAME="password1" VALUE="" SIZE="10"
        MAXLENGHT="15"><BR><BR>
    <B>New email</B> (required for confirmation)<BR>
    <INPUT TYPE="TEXT" NAME="new_email" VALUE="" SIZE="20"
        MAXLENGHT="35"><BR><BR>
    <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Send my confirmation">
    </FORM>
    </TD>
    </TR>
    </TABLE>
    EOFORMSTR;

    echo  $form_str;
   
    site_footer();
   
    ?>
   
0
Comment
Question by:abelgarcia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 3
14 Comments
 
LVL 29

Expert Comment

by:TeRReF
ID: 17064485
Don't use space, so change:
$form_str = <<< EOFORMSTR
to
$form_str = <<<EOFORMSTR
0
 
LVL 29

Accepted Solution

by:
TeRReF earned 500 total points
ID: 17064489
It's called the heredoc.
It's a way to delimit strings. Especially suitable for longer strings. Read more about it here:
http://nl2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17064496
I have not seen that in php until today, but in FTP....

this line:
  $form_str = <<< EOFORMSTR
tells to assign to the variable $form_str   all the lines that follow that line until a line with EOFORMSTR is found

0
Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17064499
I see TeRReF posted the document link, learned something new today (will help me ALOT) !!!
thanks TeRReF
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 17064586
You're welcome ;)
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 17067165
Grade B? Why? I answered your question didn't I?
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 17067895
@ angelIII
Not really. My first answer actually dealed with that. The parse error was because of the space between <<< and EOFORMSTR

Right?

0
 
LVL 29

Expert Comment

by:TeRReF
ID: 17069226
Oh, thanks!
0
 

Author Comment

by:abelgarcia
ID: 17078826
Actually with all respect due to TeRRef the 'space' ($form_str = <<< EOFORMSTR) in question did not solve my problem yet, not becuase it may not be
correct but becuase there is still something wrong with the code and I have not got it to appear in the editor as it should. If I dont get a parse error
the editor thinks that the script is not close and the closing tag ?> is not hightlighted as it should etc....
This is the first question I ask, perhaps I am not quite sure how the grading actually works I will have to be more careful.
If anyone is up to it could they point out what it is in the code example that is still in error. Thank you all...
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17079042
>the editor thinks that the script is not close and the closing tag ?> is not hightlighted as it should etc....
I am quite sure that the editor does not support the heredoc notation, what editor is it? can you check with it's documentation? can you test with a small test file:

<?php
$var =<<<EEEEEE
<test>hello</test>
EEEEEE;
print $var;
?>
0
 

Author Comment

by:abelgarcia
ID: 17096134
<?php
$var =<<<EEEEEE
<test>hello</test>
EEEEEE;
print $var;
?>

this script works fine..
0
 

Author Comment

by:abelgarcia
ID: 17102903
ok thanks everyone; the problem did have to do with spaces but in the closing
tag...

 </TD>
 </TR>
 </TABLE>
 
(I had a space here)EOREGSTR  
echo $reg_str;
 
site_footer();
 
 ?>
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question