Hello, I am using FCKeditor to inserting news content
now my problem is after submitting the news sucessfully. I get all other new items on the same page if i need to edit them on clicking the edit button the fckeditor not loads the old content until i change this part from
$oFCKeditor = new FCKeditor('news_description'); to $oFCKeditor = new FCKeditor('anyother_name');

but trouble for me is this news_description is the important one
which repeats multiples times

here is my code for for submitting the news

<tr>
    <td align="right">News Detail :&nbsp;</td>
    <td><label>


                <?php        
                include("FCKeditor/fckeditor.php");     
                $oFCKeditor = new FCKeditor('news_description');
                $oFCKeditor->BasePath = 'FCKeditor/';
                $oFCKeditor->Value = nl2br($htmlData);
                $oFCKeditor->Create();
        ?>
    </label></td>

  </tr>

and this code which creates list items for editing the news and load news items

<?php 
         ///////////////////////////////////////////////////////////////////////////////////////
         include('common/pagingprocess.php');
         ///////////////////////////////////////////////////////////////////////////////////////
         $sql .=  " LIMIT ".$start.",".$limit;
         $i=$i+$start;
         $result = @mysql_query($sql);
         $rec = array();
         while( $row = @mysql_fetch_array($result) )
         {
            $rec[] = $row;
         }
        if(count($rec)>0)
        {
            foreach($rec as $items)
            {

    ?>
              <tr>
                <td><?php echo ++$i;?> </td>
                <td><?php echo $items['news_heading'];?> </td>
                <td><?php echo $items['news_description']; ?> </td>
                <td><?php
                $timestamp= strtotime($items['date_added']);
                echo strftime('%d %B %Y %X', $timestamp);

                ?> </td>
                <td><?php if($items['news_status'] == 1) echo "Active"; else echo "Inactive"; ?> </td>

                <div id="dialog_<?php echo $items['news_id']; ?>" title="<?php echo $items['news_heading'];?>" style="display:none;">
  <p><img src="<?php echo ru_media; ?>news_image/<?php echo $items[news_image] ;?>"  /></p>
</div>
                <td valign="middle">
                    <img src="<?php echo ru_img;?>viewIcon.gif"  style="cursor:pointer;" title="Edit News" id="logo_<?php echo $items['news_id'];?>" onclick="modelme(<?php echo $items['news_id'];?>)"  />

                    <img src="<?php echo ru_img;?>edit.gif"  style="cursor:pointer;" title="Edit News" onclick="document.getElementById('<?php echo $items['news_id'];?>').style.display='block'"  />  &nbsp;&nbsp;
                    <img src="<?php echo ru_img;?>dlt.gif"  style="cursor:pointer;" title="Delete News" alt="Delete News" onclick="if(confirm('Are sure you want to delete')){window.location='<?php echo ruadmin; ?>process/process_news.php?p=del&id=<?php  echo $items["news_id"];?>&script=news' }"  />

                        </td>
              </tr>  




              <tr>

              <td colspan="7" align="right">
              <div id="<?php echo $items["news_id"];?>" style="display:none;">

              <form name="form1" enctype="multipart/form-data" action="<?php echo ruadmin; ?>process/process_news.php?p=editnews&id=<?php  echo $items["news_id"];?>&script=news" method="post">
              News Heading: &nbsp;<input type="hidden" name="editnews" id="editnews" value="<?php echo $items['news_id'];?>"/>
              <input type="text" name="edit_news_heading" id="edit_news_heading" size="30" class="text-input" value="<?php echo $items['news_heading'];?>"/><br />
              News Detail: &nbsp;

                                <?php        
                $templatecontent = html_entity_decode(stripslashes($items['news_description']));                                
                include("FCKeditor/fckeditor.php");     
                $oFCKeditor = new FCKeditor('news_description');
                $oFCKeditor->BasePath = 'FCKeditor/';
                $oFCKeditor->Value = $templatecontent;
                $oFCKeditor->Create();
        ?>
<br />
              News Image: &nbsp;
              <input type="file" id="edit_news_image" name="edit_news_image" class="text-input small-input"> Please Upload Image Size   <input type="hidden" name="oldimage" id="oldimage" value="<?php echo $items['news_image'];?>"/><br />
              News Status: &nbsp;

              <input type="checkbox" name="edit_news_status" id="edit_news_status" value="kashif" <?php if ($items['news_status']==1) echo "checked=checked"; ?>/><br />

              <input type="submit" class="button" name="submit" value="Update" />&nbsp; <input type="button" value="Cancel" class="button" onclick="document.getElementById('<?php echo $items['news_id'];?>').style.display='none'"  />
               </form>
              </div>



              </td>
              </tr>

you're not going to be able to create multiple instances with the same name
each time you loop your telling the edit button to only work on the last one

Member Avatar for diafol

Any reason why you're using FCKeditor instead of CKeditor?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.