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.

Link to comment
Share on other sites

<?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\" />";

Link to comment
Share on other sites

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\" />";

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.