Home » Php » php – How to retrieve data from database and able to edit in summernote editor?

php – How to retrieve data from database and able to edit in summernote editor?

Posted by: admin February 25, 2020 Leave a comment

Questions:

I’m facing a problem and i couldn’t find a solution to solve it.
My problem is that i have apply a plugin which called as ( Wysiwyg – summernote editor into my Laravel framework project ) . Everything works fine but when i click on the edit page, the data is unable to retrieve from the database and directly edit with the editor function. Can anyone familiar with this help me out ? Thank you so much

As you can see my placeholder is the value retrieve from the database, i just wondering why i couldn't put the data into the editor function and directly edit from it

<div class="form-group">


 <label for="company_policy_policy_details">Please Enter Policy Details<span<p><font color="#F05340"> *</font></p></label></span>

                <input type="text" name="policy_details" id="abc"  class="form-control" value="{!!$policy->policy_details!!}" cols="139" rows="10">
                </textarea>
            </div>



            <div id="summernote"></div>

            <script>

                $('#abc').summernote({
                    placeholder:value="{!!$policy->policy_details!!}",
                    tabsize: 2,
                    height: 100
                });
            </script>
            </body>
            </html>
            </div>`

Expected output = i want the value in placeholder are able to show inside the editor and able to edit it directly , Thankssssss

After update , but not the expected output i want

How to&Answers:

I believe this code will show the data from your db.

$('#summernote').summernote({
    placeholder: "{!!$policy->policy_details!!}",
    tabsize: 2,
    height: 100
}).summernote('code', `{!!$policy->policy_details!!}`);