PDA

View Full Version : Opening flatfile, then printing contents in textarea


Scrowler
07-23-2003, 05:52 AM
I want to open say mainnav.php and print its contents in a text area, where it can be edited, then using onClick() I want to update the textarea and save it to the file.

firepages
07-23-2003, 07:22 AM
to get the contents of a file easily into a string...


<?
$content = implode( '' , file( $filename ) ) ;
?>


to put $content wherever you echo it

<textarea name="content"><? echo $content ; ?></textarea>


onclick is a javascript issue

to save the contents of say form data

<?
$fp = fopen( $filename , 'w' ) ;
fputs( $fp , $_POST[ 'contents' ] ) ;
fclose( $fp );
?>


why not have a go yourself and ask for specific advise if you run into problems , thats what we are here for

Scrowler
07-23-2003, 10:12 AM
Ok, I want a page protected by a login dialog like cPanel, with one of these to edit the HTML for mainnav.php and a seperate one to edit playernav.php and below it, I want one to do what I posted in the Edit SQL entries thread. Thanks man :)