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
568 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 125 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

734 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