mindmup / bootstrap-wysiwyg

Tiny bootstrap-compatible WISWYG rich text editor
MIT License
5.55k stars 840 forks source link

Save text in MySQL with HTML-Code #203

Open MarcTroll opened 9 years ago

MarcTroll commented 9 years ago

Hey,

I'm using this Editor for my Website and I would like to save the input/text with all Tags as HTML in my MySQL database. How can I realize this? I tried a lot, but my system doesn't convert from WYSIWYG to HTML-Code to save it with vaild HTML-Tags. I hope you can help me.

~ ilou

hamada147 commented 9 years ago

I just started using it so I don't know if this is going to help or not but have you tried taking all the data inside the div id="editor" using JS like this

var data = document.getElementById('editor').innerHTML;

then send it to php throw a button that do a function and this function take the data from the div then send it to a php file like this

var url = "example.php?data=";
url += (string)data; // which is the variable that we saved all the data into it 
window.location = url;

try it and tell me if dose work or not but i think it should work fine from my concept perspective