<div class="editor">
<textarea name="art_cnn" id="art_cnn" style="display:none" ><?php echo $row[4] ?></textarea>
   <?php 
   include_once("fckeditor/fckeditor.php"); 
                     $oFCKeditor=new fckeditor('art_cnn'); 
                     $oFCKeditor->BasePath='fckeditor/'; 
                     $oFCKeditor->value='';
                     $oFCKeditor->Width='850px'; 
                     $oFCKeditor->Height='500px'; 
                     $oFCKeditor->create(); 
                     //$fck=$oFCKeditor->CreateHtml(); 
  ?>
  </div>
这个 textarea  和 fckeditor 是捆绑一起的,
check的时候 我这样写 $art_cnn=$_POST['art_cnn'];
但是获取不到它的值,是不是我写的不对,
应该怎么写?
请教一下!

解决方案 »

  1.   

    <textarea>外面要加form才行。
      

  2.   


     <div class="editor">
     
                <?php 
     include_once("fckeditor/fckeditor.php");
                         $oFCKeditor=new fckeditor('art_cnn'); 
                         $oFCKeditor->BasePath='fckeditor/'; 
                         $oFCKeditor->value='';
                         $oFCKeditor->Width='850px'; 
                         $oFCKeditor->Height='500px'; 
                         $oFCKeditor->create(); 
                         //$fck=$oFCKeditor->CreateHtml(); 
     ?>
    </div>
    </form>
    <textarea name="art_cnn" id="art_cnn" style="display:none" ><?php echo $row[4] ?></textarea>这样写的话 确实可以获取到值
    但是
    现在这个代码是获取上个页面传过来的值
    这样写的话,上个页面传过来的值就没法在这个页面获取到了
    说明白点 这个是文章修改页面! 
    有啥办法吗?
      

  3.   

     $oFCKeditor->value='';修改需要赋值,默认大写的 $oFCKeditor->Value,除非你改过
      

  4.   

    $oFCKeditor->Value=''
      value  里需要写什么吗?
    还是?
    请教!!!
      

  5.   

    你是说修改页面 读取数据库里的值吗?
    如果是修改页面 刚开始进来是读取数据库里的值。然后再提交表单这样你修改的值也可以POST过去了啊。
    可以获取的到啊。
      

  6.   

    是啊,就是修改页面~!
    如果把textare放在form里  就可以读取到数据库的值
    但是POST过去的时候  无法获取到值!
    我就愁这个呢!!如果把textare放在form外面的话   无法读取到数据库的值,
    如果再编辑器里写内容的话,POST过去之后就可以获取到了
     不明白!!! 
      

  7.   

    $oFCKeditor->Value = '………………';这就是对fckeditor赋值了,你不需要一个="display:none"的textarea
      

  8.   


    我明白你的意思~~
    之前我也没加  display:none"的textarea
    但是不加的话  获取不到数据库的值
    有没有什么好办法?
      

  9.   

    取不到数据库的值,那是你前面数据库语句的问题
    $oFCKeditor->Value = '………………';//这就是赋值,,,,后面fckeditor的CreateHtml()方法,会给你把值显示出来的
      

  10.   


    <?php
      $id=$_GET['id'];
      $link=@mysql_connect("localhost","root","root") or die ("数据库链接失败".mysql_error());
        mysql_select_db("art",$link);
        header("Content-type: text/html;charset=gb2312");
         mysql_query("set names 'gb2312'"); 
         $sql="select * from art_bse where id=".$id; 
         $row=mysql_fetch_row(mysql_query($sql));
       ?>关键是不知道语句咋写啊!
    大哥!
    能不能帮忙看看 怎么改?
      

  11.   


    只只能说明是你代码处理上的问题,或html结构的问题。最好把你代码完整的贴出来
      

  12.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>邮宝宝文章管理</title><!-- CSS -->
    <link href="style/css/transdmin.css" rel="stylesheet" type="text/css" media="screen" />
    <!--[if IE 6]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie6.css" /><![endif]-->
    <!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie7.css" /><![endif]--><!-- JavaScripts-->
    <script type="text/javascript" src="style/js/jquery.js"></script>
    <script type="text/javascript" src="style/js/jNice.js"></script>
    <script type="text/javascript" src="/FCKeditor/fckeditor.js"></script>
    <script language="javascript">
    function act(){
         if (art.art_nmt.value==""){
       alert("文章标题不能为空!")
       art.art_nmt.focus;
       return false;
       }
       if (art.art_aut.value==""){
       alert("作者不能为空!")
       art.art_aut.focus;
       return false;
       }
      }
    </script>
    </head><body> <div id="wrapper">
         <!-- h1 tag stays for the logo, you can use the a tag for linking the index page -->
         <h1>&nbsp;</h1>
            
            <!-- You can name the links with lowercase, they will be transformed to uppercase by CSS, we prefered to name them with uppercase to have the same effect with disabled stylesheet -->
            <ul id="mainNav">
             <li><a href="index.php" >文章管理首页</a></li> <!-- Use the "active" class for the active menu item  -->
             <li><a href="write.php">写新文章</a></li>
    <li><a href="artical_list.php">文章列表</a></li>
             <li><a href="#">更多&gt;&gt;</a></li>
             <li class="logout"><a href="#">退出</a></li>
            </ul>
            <!-- // #end mainNav -->
            
            <div id="containerHolder">
    <div id="container">
      <!-- // #sidebar -->
                  <!-- h2 stays for breadcrumbs -->
                  <h2><a href="index.php">文章管理首页</a> &raquo; <a href="#" class="active">写新文章</a></h2>
                    
                  <div id="main">
                   <h3>文章列表</h3>
       <?php
            $id=$_GET['id'];
        $link=@mysql_connect("localhost","root","root") or die ("数据库链接失败".mysql_error());
                        mysql_select_db("art",$link);
                        header("Content-type: text/html;charset=gb2312");
                        mysql_query("set names 'gb2312'"); 
                        $sql="select * from art_bse where id=".$id; 
                        $row=mysql_fetch_row(mysql_query($sql));
       ?>
       
       <form action="art_edit_chk.php?id=<?php echo $row['$id'];?>" method="post" enctype="multipart/form-data" onSubmit="return act();" name="art">
       <table width="100%" height="30" cellpadding="0" cellspacing="0">
    <tr>
                         <td width="675" height="20" class="pp">文章标题:
                           <input type="text" name="art_nmt" value="<?php echo $row[1];?>" />
                           作者:
                           <input name="art_aut" type="text" id="art_aut" size="10" value="<?php echo $row[2];?>" />
       <input type="hidden" name="art_dtc"  value="<?php echo date("Y-m-d");?> "/>
       </td>
     
                         <td width="173" align="left" class="action">
     <h5>
       <input type="submit" name="Submit" value="保存" />
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input type="reset" name="Submit2" value="取消" />
     </h5>  </td>
                     </tr>
        <tr>
        </table>
               <div class="editor">
                <?php 
     include_once("fckeditor/fckeditor.php");
                         $oFCKeditor=new fckeditor('art_cnn'); 
                         $oFCKeditor->BasePath='fckeditor/'; 
                         $oFCKeditor->Value='';
                         $oFCKeditor->Width='850px'; 
                         $oFCKeditor->Height='500px'; 
                         $oFCKeditor->create(); 
                         //$fck=$oFCKeditor->CreateHtml(); 
     ?>
     
        </div>  
       </form>
       <textarea name="art_cnn" id="art_cnn" style="display:none" ><?php echo $row[4] ?></textarea>
                    <fieldset><h3>中华邮宝宝,非集邮的集邮平台!</h3></fieldset>
                     
                  </div>
                    <!-- // #main -->
                    
                    <div class="clear"></div>
              </div>
                <!-- // #container -->
            </div>
            <!-- // #containerHolder -->
            
            <p id="footer">版权所有:中华邮宝宝. <a href="http://www.china-ybb.com">China-ybb.</a></p>
        </div>
        <!-- // #wrapper -->
    </body>
    </html>
    代码就是这样的
    具体该咋改呢?
      

  13.   

    大哥,别沉啊~~!
    如果放把 textarea 放在 form里 如果在check获取到 fck 的值啊!