Click to See Complete Forum and Search --> : show the contents of text file in a textarea


johnpikeuk
08-28-2003, 01:34 PM
I am attempting to show the contents of a simple text file in a forms textarea. Can anybody assist please.

Exuro
08-28-2003, 02:46 PM
Actually, you can't do this with JavaScript. You'd have to use a server-side language such as PHP or ASP. All you'd have to do is "include" the text file inside you <textarea> tags!

Here's how you'd do it in ASP:

<textarea>
<!-- #include file ="textFile.txt" -->
</textarea>


Here's how you'd do it with PHP:

<textarea>
<?php include('textFile.txt'); ?>
</textarea>

johnpikeuk
08-28-2003, 03:34 PM
Thanks, I've tried the script on PHP enabled server and it works fine - Thanks again

Fire Cat
04-17-2009, 10:22 AM
Can you tell me how I can edit the textarea and save the changes to the file?

ZeroKilled
04-17-2009, 12:50 PM
@Fire Cat:
you can change the content as you like in the TEXTAREA or in a RTE, but on javascript isn't possible to save the content on the file. however, you can send the content back to server (with submit form) and have the server to save the content in file. also, consider that there seems to be a limit of the size of data that can be send. following thread discuss briefly about this matter. http://www.webdeveloper.com/forum/showthread.php?t=206341