Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.