Jump to content

[SOLVED] PHP Heredoc Inside A Function - Not Working


jadedknight

Recommended Posts

I have seen examples (specifically in the book 'Learning PHP 5') of a heredoc inside a function, however when I attempt the same thing, I get an error:

 

Parse error: syntax error, unexpected $end in PATH\add_note.php on line 26

 

The error, I presume is because the PHP document is ending but the function? Or something else is not. Here is the code I am using.

 

<?php
function print_form() {
print <<< FORM
<form action="addnote_validate.php" method="post">
<label for="title">Title</label>
<input type="text" id="title" name="title" />

<label for="url">Related URL <span>(optional)</span></label>
<input type="text" id="url" name="url" />

<label for="content">Note</label>
<input type="text" id="note" name="note" />

<label for="tags">Tags <span>(seperated with a space)</span></label>
<input type="text" id="tags" name="tags" />

<input type="submit" value="Save Note"/>
</form>

FORM;
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.