Page 1 of 1

[SOLVED] Problem with a form...?

Posted: Wed Jun 23, 2004 1:46 pm
by Goowe
This might go under client side designing, but I think PHP is the solution to the problem (if there lies a solution) :roll:

I have a script that I'm trying to create to edit files on a web host. It uses file_get_contents() to put the contents inside a <textarea> tag.

Code: Select all

<?php
echo "<textarea cols=40 rows=40 style='width: 400px' name='file_contents'>".file_get_contents($_GET['path'])."</textarea>";
?>
If a user selects a file to edit that has a </textarea> tag and it's opened within that textarea, it thinks that it needs to close the textarea tag at that spot in the file and the rest of the contents within the file get put outside and are "splashing" around the page :(

Is there a way to perhaps buffer the contents or someway to get the </textarea> tags (within the to-be edited file) to not end the "<textarea cols=40 rows=40 style='width: 400px' name='file_contents'>" tag? :?

Thanks for reading :)

Posted: Wed Jun 23, 2004 1:48 pm
by feyd

Code: Select all

echo '<textarea>'.htmlentities($filecontents,ENT_QUOTES).'</textarea>';

Posted: Wed Jun 23, 2004 1:51 pm
by Goowe
Like a charm! :D Thanks for the quick and helpful responce :D

Posted: Wed Jun 23, 2004 5:19 pm
by tim
Hey goowe

how have you been? I thought you left us here