2010-09-06 47 views
1

我是新來的這個FCKeditor,我使用下面提到的代碼,我在文本編輯器中格式化文本,並使用echo語句顯示相同的文本,但它只顯示純文本(沒有格式)如何使用格式化語法顯示文本。請指導我.thanks提前如何使用php添加FCKeditor

<?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; 
} 
?> 

回答

2

【答案更新]

你需要把你的FCKEditor的代碼<form> </form>標籤內,而不是在頂部。此外,$_POST["FCKEditor"]需要放在$oFCKeditor->Value變量中。

做這樣的:它是工作在我的機器上的罰款,並顯示FCKEditor的文字區域內的格式化的HTML:

<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> 

提示:View more information and complete guide here.

+0

非常感謝您的回覆,我看到鏈接我遵循該鏈接給出的指示。使用$ _POST [「FCKeditor」]聲明,我得到了文本。但是,如果我想存儲在數據庫中的文本爲此,我需要的語法 – Meena 2010-09-06 07:52:31

+0

例如:如果我將文本 - >處理使用編輯器粗體斜體。在回聲聲明它必須顯示像這樣治療 。 IT是可能的 – Meena 2010-09-06 07:54:44

+0

@Meena,我已經更新了我的答案和代碼。現在閱讀答案。 – shamittomar 2010-09-06 11:55:52