如何在fckeditor中编辑内容

时间:2012-10-24 06:54:21

标签: php html database forms fckeditor

这是我的代码。我想编辑fckeditor中的内容或值。此代码正在运行插入和选择查询但无法更新。请帮我解决一下。

下面是从数据库接收id以选择记录

<?php 
    if (isset($_REQUEST['editncontent'])) {
        $editnews  = new DBConnection();
        $condition = "WHERE id = '".$_REQUEST['editncontent']."'";
        $selnews   = $editnews->SelectRecord(array("*"),"pages","$condition");

        while ($getnews = mysql_fetch_array($selnews)){ ?>
            <form action="" method="post">
            <?php
                $oFCKeditor = new FCKeditor('FCKeditor1');
                $oFCKeditor->BasePath = 'fckeditor/';
                $oFCKeditor->Width = 740;
                $oFCKeditor->Height = 600;
                $oFCKeditor->Value  = $getnews['content'];
                echo $oFCKeditor->Create();
            ?>
            </form>
<?php } } ?>

// Now it takes the parameter and going to update it         
// Update query

<?php  
    if (isset($_REQUEST['content'])) {
        $content = mysql_real_escape_string(trim($_POST['FCKeditor1']));

        $obj        = new DBConnection();
        $arr_field  = array("content");
        $arr_values = array("$content");
        $condition  = "WHERE id = '".$_REQUEST['editncontent']."'";
        $update     = $obj->UpdateRecord(
            "pages",$arr_field,$arr_values,"$condition"
        ) or die(mysql_error());
        header("Location:showpages.php");
    }
    ob_flush();
?>

0 个答案:

没有答案