Jump to content

[SOLVED] Read file and print result in textarea


pcw

Recommended Posts

Hi,

 

I am trying to read a file and display its contents in a textarea. This is what I have got:

 

<?php

include("../../addons.php");

function add_temp() {

adminheader();
$filename = "admin_header.php";
$fp = fopen( $filename, "r" ) or die("Couldn't open $filename");
while ( ! feof( $fp ) ) {
$line = fgets( $fp, 1024 );
}
print <<<ADDTEMP
<form action="../../admin.php" method="POST">
Template Name:<input type="text" name="temp_name"></br>
Folder:<select name="temp_folder">
<option>admin</option>
<option>common</option>
<option>extras</option>
<option>mail</option>
<option>members</option>
</select>
<textarea name="template">$line</textarea>
ADDTEMP;

adminfooter();

}

add_temp();
?>

 

But when I run the script, it shows the textarea with ?> in it, and thats it. How do I print all the contents of the file, in the textarea?

 

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.