1
<textarea cols="80"  id="editor1"    name="content" rows="10" >    
</textarea>     
<script>
    CKEDITOR.replace( 'editor1' );
</script>

That is working properly and I am getting the edit textbox, but now I need to get data from the database. For that I am doing:

<textarea cols="80"  id="editor1" value="<?php echo $rows['content']; ?>"   name="content" rows="10" >  

</textarea>         
<script>
      CKEDITOR.replace( 'editor1' );
</script>

But it does not show me my data.

I have tried data I am getting in simple textarea but not in CKEDITOR.

What am I doing wrong?

1
  • 1
    <textarea cols="80" id="editor1" name="content" rows="10" > <?php echo $rows['content']; ?> </textarea> Commented Aug 12, 2013 at 11:58

5 Answers 5

5
<textarea cols="80"  id="editor1" name="content" rows="10" >

    <?php echo $rows['content']; ?>

</textarea>

Try this. Hope this help. Thank You :-)

Sign up to request clarification or add additional context in comments.

Comments

1

Textarea value should be stored inside textarea, not in value attribute:

<textarea> <?= $value ?> </textarea>

Comments

1

textarea Don't have value attribute. Use this code:

<textarea cols="80"  id="editor1" name="content" rows="10" >

    <?php echo $rows['content']; ?>

</textarea>

Comments

1

if you wanted to replace the entire editor content, in which case you'd want to use setData().

or you can also use

Use insertHtml() or insertText() method.

or with sample php code as html by text aread

<textarea cols="80"  id="editor1" name="content" rows="10" >

    <?php echo $rows['content']; ?>

</textarea>

Comments

-1

i experienced this and solved this. i needed jquery.

first: <textarea id = "editContent"> </textarea> <script> CKEDITOR.replace('editContent'); </script>

<?php $content = $row['content']; ?>

`<div id = "myDiv"><?php echo $content?></div>

<script> CKEDITOR.instances.editContent.setData($("#myDiv").html()); </script>

1 Comment

wow i did not think it was so strict to post some html php javascript. hope it will help you out like it did to me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.