After two dayes serching this forum and google i really need some help.
I am a complete newbie, and probably want to do something advanced... stupid eh ?
Here we go.
I have the FCKeditor php sample1 up and running.
It works, i can write and post with it.
Now i need to save the output to a file.
I also got the file writable, and can write in it with a code i found on this forum.
What i dont seem do figure out, is to combine these two things. The Form witch sends the data, and the code bit that write it to a file.
Here is what i got:
The fck editor, working nice
<form action="../../../default.php" method="post" name="test" target="_blank" id="test">
And the code for writing the file:
Also working nice, but only with inserted text in fwrite. Cant figure out to put in a variable from the form.
<input name="Submit" type="submit" value="Submit">
</form>
Thanks, any help is appriciated.
And sorry my English.
I am a complete newbie, and probably want to do something advanced... stupid eh ?
Here we go.
I have the FCKeditor php sample1 up and running.
It works, i can write and post with it.
Now i need to save the output to a file.
I also got the file writable, and can write in it with a code i found on this forum.
What i dont seem do figure out, is to combine these two things. The Form witch sends the data, and the code bit that write it to a file.
Here is what i got:
The fck editor, working nice
<form action="../../../default.php" method="post" name="test" target="_blank" id="test">
<?php // Automatically calculates the editor base path based on the _samples directory. // This is usefull only for these samples. A real application should use something like this: // $oFCKeditor->BasePath = '/FCKeditor/' ; // '/FCKeditor/' is the default value. $sBasePath = $_SERVER['PHP_SELF'] ; $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ; $oFCKeditor = new FCKeditor('FCKeditor1') ; $oFCKeditor->BasePath = $sBasePath ; $oFCKeditor->Value = 'testing' ; $oFCKeditor->Create() ; ?>
And the code for writing the file:
Also working nice, but only with inserted text in fwrite. Cant figure out to put in a variable from the form.
<?
$filename = "../../../test.txt"; //or a variable
$fp = fopen($filename, "w");
fwrite($fp, ????);// Close the file
fclose($fp);
?> <br>
<input name="Submit" type="submit" value="Submit">
</form>
Thanks, any help is appriciated.
And sorry my English.
RE: save output to a file (newbie alert)
You can get the whole html as a POST variable with name you gave for editor in html page
so
fwrite($fp, $_REQUEST['FCKeditor1']);
will write the outout to file
see http://wiki.fckeditor.net/ for more details
RE: save output to a file (newbie alert)
Thank you bobzee for your quick reply.

I used your
fwrite($fp, $_REQUEST['FCKeditor1']);
in the code for writing to file, but with no luck.
Unfortunately im not very bright
I have the two above scripts in the same file. Is that the correct way ? I will post the complete script in the bottom of this message.
Alså, you say i can find this info in the wiki for fckeditor... i thought i have read it over and over, but without any luck on this subject. But as i said, im not very bright, and my techinical english could be a lot better, so i might have missed it.
here is the whole file. It writes to the default.php , but is not saving anything in the test.txt file.
include("../../fckeditor.php") ;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html> <head> <title>FCKeditor - Sample</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="robots" content="noindex, nofollow"> <link href="../sample.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>FCKeditor - PHP - Sample 1</h1> This sample displays a normal HTML form with an FCKeditor with full features enabled. <hr> <form action="../../../default.php" method="post" name="test" target="_blank" id="test"> <?php // Automatically calculates the editor base path based on the _samples directory. // This is usefull only for these samples. A real application should use something like this: // $oFCKeditor->BasePath = '/FCKeditor/' ; // '/FCKeditor/' is the default value. $sBasePath = $_SERVER['PHP_SELF'] ; $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ; $oFCKeditor = new FCKeditor('FCKeditor1') ; $oFCKeditor->BasePath = $sBasePath ; $oFCKeditor->Value = 'Indhold kommer snart' ; $oFCKeditor->Create() ; ?> <? $filename = "../../../test.txt"; //or a variable $fp = fopen($filename, "w"); fwrite($fp, $_REQUEST['FCKeditor1']); fclose($fp); ?> <br> <input name="Submit" type="submit" value="Submit"> </form> </body> </html>
RE: save output to a file (newbie alert)
If you just write out the content of the post, what do you get?
As you say it doesnt write anything to the file, I think this is the problem.
BTW: Is the file created?
Im using ASP, and there I create the form element with
oFCKeditor.Create "content"
and access it through
request.form("content")
Are you sure that 'FCKeditor1' is the name you should use?
Johnny
RE: save output to a file (newbie alert)
Thanks Johnny for trying to help.

To make things easy, here is the file i use :
http://www.anjaro.dk/kenneth/sample01.rar
And here you can see the above script in use:
http://www.anjaro.dk/kenneth/FCKeditor/ ... mple01.php
As you can see, the script writes out the variable on the destination page default.php , no problem.
But it does not write to the test.txt
test.txt is chmod 777 and it works fine if i just use fwrite($fp, HELLO WORLD);
I really appriciate your help on this. Please dont give up on me
RE: save output to a file (newbie alert)
I assume that you get "HELLO WORLD" in the textfile?
Then its a php-problem, and thats not my cup of tea.
Why don't skip the textfile and save it in a db, or you're testing/cant use a db?
Johnny
RE: save output to a file (newbie alert)
Just cant figure out hot to replace HELLO WORLD, with the output from FCK.
I assume that the problem would be the same with or without a db. Writing to db or a file is the same story, no ?
Well i decided not to use a db, because it a small page for my son, and extra db cost me money. I figured a db was overkill.
Well thanks for your try anyway Johnny. Mutch appriciated.
RE: save output to a file (newbie alert)
I got it, i got it
Im just a fool with scripts, but i figured it out.
Thanks for both your help.
RE: save output to a file (newbie alert)
RE: save output to a file (newbie alert)
thanks