nicEdit - unable to retrieve data from mysql

83 Views Asked by At

I have added nicEdit for styling of a textarea in my php page called Questions.php. I am able to save the formatting to the mysql table column.

After submission, when trying to view the same data in the same page, it is coming empty. The questions.php is as below:

<script type="text/javascript" src="nicEdit.js"></script>
<script type="text/javascript"> bkLib.onDomLoaded(function() { nicEditors.allTextAreas() }); </script>

<form id="question-form" method="POST" action="<?php echo "$question_action" ?>"> 
        <p id="question_field" name="question_field" class="hidden">
            <strong id="title_title" class="pretty">Title : </strong>
            <br> type="text" name="title">  <br>
            <strong id="details_title">Details : </strong>
            <br> <textarea rows="4" cols="50" name="details"></textarea> <br>
            <input id="submit" type="submit">
        </p>
    </form>

After submission, the form is loaded through a javascript which fetches the value from database. the javascript has following code:

function fillForm() {
    var questionForm = document.getElementById('question-form');
    var title = document.getElementById('question-title').innerText;
    var description = document.getElementById('question-description').innerText;
    questionForm.title.value = title;
    questionForm.details.value = description;
}
window.addEventListener("load", fillForm, false);

I know I need to do some manipulation of the 'details' field which should show the formatted text. Can someone please guide me, I have researched all the previous posts on this site.

0

There are 0 best solutions below