RE: Textarea to road a text file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
<html><head><title>.....
<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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux