Jump to content

why does this not display in an echo?


sphinx

Recommended Posts

I have no idea what you are trying to do there.. Can you show the WHOLE snippet of code, not just that half line..

It looks like you are opening php tags inside, what I presume to be, an echo statement.

 

If you are wanting to use that text file as the value of a HTML element use file_get_contents(), but without seeing the rest of the code I cant help with implementing it.

<?php
$song = file_get_contents('http://site.com/song.php');
if(!empty($song))
{
echo "

<form action=\"config.php\" method=\"post\"><br />
<input name=\"checkbox\" value=\"Enable music requests\" type=\"submit\" /><br /><br />
<input name=\"checkbox2\" value=\"Disable music requests\" type=\"submit\" />
</form>
<form name=\"input\" action=\"process2.php\" method=\"post\">
DJ Message:<br /> <input type=\"text\" size=\"50\" maxlength=\"200\" value=\"<? include(\"djmessage.txt\"); ?>\"  name=\"checkbox3\" />
<input type=\"submit\" value=\"Update\" />";

echo "

<form action=\"config.php\" method=\"post\"><br />
<input name=\"checkbox\" value=\"Enable music requests\" type=\"submit\" /><br /><br />
<input name=\"checkbox2\" value=\"Disable music requests\" type=\"submit\" />
</form>
<form name=\"input\" action=\"process2.php\" method=\"post\">
DJ Message:<br /> <input type=\"text\" size=\"50\" maxlength=\"200\" value=\"".file_get_contents("djmessage.txt")."\"  name=\"checkbox3\" />
<input type=\"submit\" value=\"Update\" />";

Firstly, your already within php tags, so you don't need more. Secondly, include includes the output of the file where it is called. it does not need to (and can't) be echo'd.

 

It can be echo'd, but only if the include is terminated with a return.  Source.  I've never used it myself, but just know that it is there.

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.