On Mon, 2002-02-04 at 10:32, Peter J. Schoenster wrote:
> Hi
> 
> If I use $snippet = ""; and escape the quotes in the block then it 
> works. But if I use it as is below, it fails with no useful error 
> message. Why?
> 
> Thanks,
> 
> Peter

This function cut-and-pasted? If so, then you may have fallen prey
to one of the uglier little features of heredocs: you cannot have
anything except a newline following the semicolon after the closing
delimiter. In this case, you seem to have some spaces there:

>   function GetAddCommentSnippet($args) {
>         $topic_id             = $args[id];
>         $return_page  = $args[return_page];
> 
>       $snippet = <<<EOS
> <form action="$this->this_cgi" method="post">
> <br>Your First Name: <input type="text" name="FirstName" value="">
> <br>Your Last Name: <input type="text" name="LastName"  value="">
> <br>Your Email Address: <input type="text" name="EmailAddress"  value="">
> <br>Your Comments: 
> <br>
> <textarea cols="40" rows="4" name="Comments"></textarea>
> <br>
> <input type="submit" value="submit now">  
> <input type="hidden" name="action" value="AddComment">
> <input type="hidden" name="response_to_id" value="$topic_id">
> <input type="hidden" name="r" value="$return_page">
> </form>
> EOS;    
      ^^^^

...here are the spaces. There is more information in the manual:

http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc


However, just so you know, you should quote 'id' and 'return_page' 
in the first two lines of the function. If you turn up 
error_reporting(), you'll get this:

  Notice:  Use of undefined constant id - assumed 'id' in 
  /path/to/script.html on line 19

  Notice:  Use of undefined constant return_page - assumed 
  'return_page' in /path/to/script.html on line 20

There is more information about this at:

http://www.php.net/manual/en/language.types.array.php#language.types.array.donts

(Sorry if the URLs wrap.)


Cheers,

Torben

>       
>       return $snippet;
> 
> 
>   } // END GetAddCommentSnippet
> 
> 
> ---------------------------
> "Reality is that which, when you stop believing in it, doesn't go
> away".
>                 -- Philip K. Dick

-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to