[SOLVED] Problem with a form...?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Goowe
Forum Commoner
Posts: 94
Joined: Mon Mar 15, 2004 9:51 am
Location: Southeast Alaska

[SOLVED] Problem with a form...?

Post 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 :)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

echo '<textarea>'.htmlentities($filecontents,ENT_QUOTES).'</textarea>';
Goowe
Forum Commoner
Posts: 94
Joined: Mon Mar 15, 2004 9:51 am
Location: Southeast Alaska

Post by Goowe »

Like a charm! :D Thanks for the quick and helpful responce :D
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

Hey goowe

how have you been? I thought you left us here
Post Reply