Jump to content

[SOLVED] PHP code in here document


Recommended Posts

I'm a bit confused, can you tell how i could place <?php ?> inside the <<< document? I put in like this, but the browser just spit it out as text, and doesn't run the code inside...

 

if(isset($_GET['addjoke']))

{//Note : \x5B and \x5D is code for [ and ] character.

$HTMLFORM = <<<JOKEFORM

<form name="jokeForm" method="post" action="<?php echo $_SERVER\x5B'PHP_SELF'\x5D;?>">

<lable for="insertJoke">Please enter your joke here</lable><br />

<textarea name="insertJoke" cols="50" rows="15" ></textarea><br />

<input type="submit" value="ENTER"/>

</form>

 

JOKEFORM;

 

echo $HTMLFORM;

}

Link to comment
https://forums.phpfreaks.com/topic/80226-solved-php-code-in-here-document/
Share on other sites

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.