Re: Why does heredoc fail in this instance?
| From: | mike cullerton | Date: | Mon, 04 Feb 2002 18:02:56 +0000 |
| Subject: | Re: Why does heredoc fail in this instance? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-83432@lists.php.net to get a copy of this message | ||
on 2/4/02 11:32 AM, Peter J. Schoenster at php@errorcode.com 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?
not sure if this is it or not, but from the manual
http://www.php.net/manual/en/language.types.string.php
Variables are expanded, but the same care must be taken when expressing
complex variables inside a here doc as with strings.
i wonder if $this->this_cgi is causing the problem
>
> Thanks,
>
> Peter
>
> 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;
>
> return $snippet;
>
>
> } // END GetAddCommentSnippet
>
>
> ---------------------------
> "Reality is that which, when you stop believing in it, doesn't go
> away".
> -- Philip K. Dick