Re: [PHP] Textarea to road a text file
Yes, I just want to edit a file in the textarea! thank you. Jay Blanchard jblanch...@pocket.com wrote in message news:31454d514ff9a949b1fdfe294d5d1d80080...@ygex01wal.onecall.local... [snip] htmlheadtitle. body.. ?php $handle = fopen(./menu.php, r); $contents = ; if ($handle) { while (!feof($handle)) { $buffer = fgets($handle); $contents = $contents . $buffer; } fclose($handle); } echo textarea cols=80 rows=30 . $contents . /textarea; ? /body /html [/snip] Try http://us3.php.net/manual/en/function.file-get-contents.php ?php $contents = file_get_contents('./menu.php'); echo textarea cols=80 rows=30 . $contents . /textarea; ? I am unsure what you want to do here, display the menu in the textarea? Or do you want to be able to edit menu.php in the textarea? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Textarea to road a text file
Jean Lee wrote: Could you explain what was my fault concerned about this case? ?php $handle = fopen(./menu.php, r); $contents = ; if ($handle) { while (!feof($handle)) { $buffer = fgets($handle); $contents = $contents . $buffer; } fclose($handle); } echo textarea cols=80 rows=30 . $contents . /textarea; ? As Andrew pointed out, you need to use htmlspecialchars() echo textarea cols=80 rows=30 .htmlspecialchars($contents). /textarea; The reason for that is because the text may contain html control characters like ' which the browser will attempt to interpret. http://php.net/htmlspecialchars I usually use htmlentities() instead http://de.php.net/manual/en/function.htmlentities.php -- John Those willing to give up a little liberty for a little security deserve neither security nor liberty. [Benjamin Franklin] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Textarea to road a text file
[snip] htmlheadtitle. body.. ?php $handle = fopen(./menu.php, r); $contents = ; if ($handle) { while (!feof($handle)) { $buffer = fgets($handle); $contents = $contents . $buffer; } fclose($handle); } echo textarea cols=80 rows=30 . $contents . /textarea; ? /body /html [/snip] Try http://us3.php.net/manual/en/function.file-get-contents.php ?php $contents = file_get_contents('./menu.php'); echo textarea cols=80 rows=30 . $contents . /textarea; ? I am unsure what you want to do here, display the menu in the textarea? Or do you want to be able to edit menu.php in the textarea? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Textarea to road a text file
I want to use Textarea as the text-file viewer and editor of my homepage. But Textarea doesn't work exactly as i intended. In sometimes, TextArea doesn't show up and moreover the some parts of the file are displayed(rendered) in browser without TextArea! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Textarea to road a text file
[snip]I want to use Textarea as the text-file viewer and editor of my homepage. But Textarea doesn't work exactly as i intended. In sometimes, TextArea doesn't show up and moreover the some parts of the file are displayed(rendered) in browser without TextArea![/snip] Not enough information to complete yourrequest? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Textarea to road a text file
On Wed, Oct 28, 2009 at 10:39 AM, Jean Lee versus...@ymail.com wrote: I want to use Textarea as the text-file viewer and editor of my homepage. But Textarea doesn't work exactly as i intended. In sometimes, TextArea doesn't show up and moreover the some parts of the file are displayed(rendered) in browser without TextArea! It sounds like you are not escaping the value that appears inside the textarea tags. textarea name=mytextarea?php echo htmlspecialchars($text_content); ?/textarea Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Textarea to road a text file
Thank you, Jay Blanchard and Andrew Ballard!!! Could you explain what was my fault concerned about this case? Thanks in advance! My codes were htmlheadtitle. body.. ?php $handle = fopen(./menu.php, r); $contents = ; if ($handle) { while (!feof($handle)) { $buffer = fgets($handle); $contents = $contents . $buffer; } fclose($handle); } echo textarea cols=80 rows=30 . $contents . /textarea; ? /body /html Jay Blanchard jblanch...@pocket.com wrote in message news:31454d514ff9a949b1fdfe294d5d1d80080...@ygex01wal.onecall.local... [snip]I want to use Textarea as the text-file viewer and editor of my homepage. But Textarea doesn't work exactly as i intended. In sometimes, TextArea doesn't show up and moreover the some parts of the file are displayed(rendered) in browser without TextArea![/snip] Not enough information to complete yourrequest? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php