I have a deadlock over storing an HTML in the DB.
I'm using the property in php: htmlentities($_POST['codhtml'])
to perform this operation. But when saving a code like:
<span class="frase-aditivo mover" id="adt6-enable" style="transform: translate3d(-2px, 202px, 0px); cursor: move; touch-action: none; -webkit-user-select: none; z-index: 1004; border: 3px dashed red; font-size: 112px; font-family: "Comic Sans MS"; color: rgb(0, 64, 128);">Leve a alegria do Natal para sua casa ! </span>
The bank is stored:
<span class="frase-aditivo mover" id="adt6-enable" style="transform: translate3d(-2px, 202px, 0px); cursor: move; touch-action: none; -webkit-user-select: none; z-index: 1004; border: 3px dashed red; font-size: 112px; font-family:
That is, for some reason the code is lost whenever there is a URL or after "font-family:".
What is the best way to do this rescue?
PS. I am using LongText.
Thank you = D
/ * CONTINUED CODE * /
$("#mt_finalizar").click(function(event) {
var codhtml = '<span class="frase-aditivo mover" id="adt6-enable" style="transform: translate3d(-2px, 202px, 0px); cursor: move; touch-action: none; -webkit-user-select: none; z-index: 1004; border: 3px dashed red; font-size: 112px; font-family: "Comic Sans MS"; color: rgb(0, 64, 128);">Leve a alegria do Natal para sua casa ! </span>';
$.ajax({
type : 'post',
url : 'salvarDados.php',
data : 'codhtml='+codhtml
+'&motivoid=2'
+'&formatoid=2'
+'&motivonome=Nome',
dataType : 'html',
success : function(txt){
alert("Sucesso,");
},
error: function(result) {
alert("Erro ao Salvar");
}
});
$resultado = $this->conexao->exec("INSERT INTO tabela (col1,col2,col3,col4,col5,col_codhtml,col6) VALUES(2,2,2,2,2,'$codhtml','Nome')");