Textarea to road a text file
Textarea to road a text file
am 28.10.2009 15:39:58 von Jean Lee
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: Textarea to road a text file
am 28.10.2009 19:52:54 von Jay Blanchard
[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 your....request?=20
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Textarea to road a text file
am 28.10.2009 19:59:43 von Andrew Ballard
On Wed, Oct 28, 2009 at 10:39 AM, Jean Lee 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.
Andrew
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Textarea to road a text file
am 29.10.2009 00:20:32 von Jean Lee
Thank you, Jay Blanchard and Andrew Ballard!!!
Could you explain what was my fault concerned about this case?
Thanks in advance!
My codes were
.....
..............
$handle = fopen("./menu.php", "r");
$contents = "";
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle);
$contents = $contents . $buffer;
}
fclose($handle);
}
echo "";
?>
""Jay Blanchard"" wrote in message
news:31454D514FF9A949B1FDFE294D5D1D80080142@ygex01wal.onecal l.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 your....request?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Textarea to road a text file
am 29.10.2009 10:49:27 von Skylinux
Jean Lee wrote:
> Could you explain what was my fault concerned about this case?
>
>
> $handle = fopen("./menu.php", "r");
> $contents = "";
>
> if ($handle) {
> while (!feof($handle)) {
> $buffer = fgets($handle);
>
> $contents = $contents . $buffer;
> }
> fclose($handle);
> }
>
> echo "";
> ?>
As Andrew pointed out, you need to use htmlspecialchars()
echo "";
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: Textarea to road a text file
am 29.10.2009 13:14:26 von Jay Blanchard
[snip]
.....
..............
$handle =3D fopen("./menu.php", "r");
$contents =3D "";
if ($handle) {
while (!feof($handle)) {
$buffer =3D fgets($handle);
$contents =3D $contents . $buffer;
}
fclose($handle);
}
echo "";
?>
[/snip]
Try http://us3.php.net/manual/en/function.file-get-contents.php
$contents =3D file_get_contents('./menu.php');
echo "";
?>
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: Textarea to road a text file
am 31.10.2009 07:14:52 von Jean Lee
Yes, I just want to edit a file in the textarea!
thank you.
""Jay Blanchard"" wrote in message
news:31454D514FF9A949B1FDFE294D5D1D8008017D@ygex01wal.onecal l.local...
[snip]
.....
..............
$handle = fopen("./menu.php", "r");
$contents = "";
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle);
$contents = $contents . $buffer;
}
fclose($handle);
}
echo "";
?>
[/snip]
Try http://us3.php.net/manual/en/function.file-get-contents.php
$contents = file_get_contents('./menu.php');
echo "";
?>
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