How To Add FCKeditor using php
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 : <input type="text" nam开发者_运维问答e="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;
}
?>
[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 : <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.
精彩评论