1

i am new to this FCKeditor,i am using below mentioned code , i am formatting the text in the text editor and display the same text using the echo statement but it disply only the plain text(without formatting) how to i display the text with formated syntax. please guide me .thanks in advance

 <?php
    include("fckeditor.php");

    $sBasePath = $_SERVER['PHP_SELF'] ;
            $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
            $oFCKeditor = new FCKeditor('FCKeditor') ;
            $oFCKeditor->BasePath   = $sBasePath ;
            $oFCKeditor->Value      = $ing ;
            $oFCKeditor->Create() ;
            ?>

<html> 
<head>

<title>Editor</title>
</head>
<body>
<form name="frmedit" id = "frmedit" method="post" enctype="multipart/form-data"> 
Title &nbsp;:&nbsp;<input type="text" name="txttitle" id = "txttitle">

<br>
<br>
<input type="submit" name="subsubmit" id="subsubmit" value="SUBMIT">
</form> 
</body>
</html>

<?php
if($_POST["subsubmit"]=="SUBMIT"){
$part2 = $_POST["FCKeditor"];
echo $part2;
}
?>

1 Answer 1

2

[Answer Updated]

You need to put your FCKEditor code inside the <form> </form> tags and not at the top. Also, the $_POST["FCKEditor"] needs to be put in $oFCKeditor->Value variable.

Do it like this: It is working fine on my machine and displays the formatted HTML inside the FCKEditor textarea:

<html> 
<head>

<title>Editor</title>
</head>
<body>
<form name="frmedit" id = "frmedit" method="post" enctype="multipart/form-data"> 
Title &nbsp;:&nbsp;<input type="text" name="txttitle" id = "txttitle">
<?php
    include("fckeditor.php");

    $sBasePath = $_SERVER['PHP_SELF'] ;
            $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
            $oFCKeditor = new FCKeditor('FCKeditor') ;
            $oFCKeditor->BasePath   = $sBasePath ;
            $oFCKeditor->Value      = $_POST["FCKeditor"] ;
            $oFCKeditor->Create() ;
            ?>
<br>
<br>
<input type="submit" name="subsubmit" id="subsubmit" value="SUBMIT">
</form> 
</body>
</html>

Tip: View more information and complete guide here.

Sign up to request clarification or add additional context in comments.

3 Comments

thank you so much for your reply, i saw the link i am follow the instruction given in that link . Using the $_POST["FCKeditor"] statement i got the text . But if i wants to store the text in the database for this i need the syntax
example:If i change the Text - > Treatme into bold italic using the Editor.In the echo statement it must be displaye like this <b><i>treatme</i></b> . IT is Possible
@Meena, I have updated my answer and code in it. Read the answer now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.