Fckeditor在PHP应用中,如何循环出在编缉器中显示的不同内容
看代码:
这个可以正常显示,
<?php
while($row = $db->fetch_array($query)){
{
?>
<form action="?" method="post">
<textarea name="test_content[]" style="padding:3px; width:90%;"><?php echo($row['content']);?></textarea>
<input type="submit" value="确定" />
</form>
<?php
}
?>
改写为下面的代码:
<?php
while($row = $db->fetch_array($query)){
{
?>
<form action="?" method="post">
<?php
                                include("../fckeditor/fckeditor.php");
                                $oFCKeditor = new FCKeditor('test_content[]');
                                $oFCKeditor -> BasePath = "../fckeditor/";
                                $oFCKeditor -> Value = $row['content'];
                                $oFCKeditor -> Create();
                            ?>
<input type="submit" value="确定" />
</form>
<?php
}
?>
输出的所有的内容都是相同的,也就是不循环,应该如何解决?

解决方案 »

  1.   

      include("../fckeditor/fckeditor.php");
      $oFCKeditor = new FCKeditor('test_content[]');
      $oFCKeditor -> BasePath = "../fckeditor/";
       把这段代码放到循环外面试试行么?
      

  2.   

    试试这个<?php
    $i=0;
    while($row = $db->fetch_array($query)){
    {
    ?>
    <form action="?" method="post">
    <?php
      include("../fckeditor/fckeditor.php");
      $oFCKeditor[$i] = new FCKeditor('test_content[]');
      $oFCKeditor[$i] -> BasePath = "../fckeditor/";
      $oFCKeditor[$i] -> Value = $row['content'];
      $oFCKeditor[$i] -> Create();
      $i++;
    ?>
    <input type="submit" value="确定" />
    </form>
    <?php
    }
    ?>
      

  3.   

    $oFCKeditor[$i] = new FCKeditor('test_content[$i]');
      

  4.   

    呵呵,改你代码的时候没改仔细,只能第一个出来的原因是生成name值都是test_content[],下面我回复的$oFCKeditor[$i] = new FCKeditor("test_content[$i]");保证了不同的name值,所以访问没有问题……