Jump to content

Convert the html content of a .txt document


coder500

Recommended Posts

I want to place a text-file on the server so that it can be edited and updated. The contents of this text file need to be scrolled within a box on a web page.  Is there anyway possible so that I can write the .txt document in html format, so that headings can be in bold or someother formatting I can apply. The code I have used is as follows.

$file = fopen("welcome.txt", "r") or exit("Unable to open file!");
echo '<center>';
echo '<table bgcolor="#efefef" width="500"><tr><td>';
echo '<textarea name="stuff" cols="60" rows="10">';
while(!feof($file))
  {
  echo fgets($file);
  }
fclose($file);

echo '</textarea><br>';
echo '</td></tr></table>';

 

The problem is if I write html code it will come as html. For example if I write <a href="">Check</a> it will appear in the textarea as <a href="">Check</a> and not as a link.

Any help, please...

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.