I want to save value in a textarea to MySQL database using PHP. And then I want to pass it to a variable in javascript The value in a textare could be like this:
Hi I'm Son!! 
Nice to meet you
So my 1st question is: How can I add the text to my database using php with the absence of special chars? (Like which encoding...)
I'm gonna pass that text through an event of a hyperlink click. It's something like this:
    <?php
    echo '<a href="#" onclick=passExample('$myText')>Something</a>';
    ?>
After all, the javascript I coded is like this:
function passExample(Exa){
            $("#ExampleShow").empty();
            var node = document.createElement("p");
            if (Exa=='') Exa=' (No example)';
            var textnode = document.createTextNode(html_entity_decode(Exa));
            node.appendChild(textnode);
            document.getElementById("ExampleShow").appendChild(node);
        }
However, the result is not the way I wanted it to be. Line breaks are missing. And if I type some character like ''", it results in errors. How can I fix this?
 
     
    