1
I have a <textarea class="form-control" id="informacoes" name="informacoes" rows="3" placeholder="descreva aqui..."></textarea>
where the user can enter various information.
The information is sent via ajax
:
function salvaFlor(){
var myForm = document.getElementById('formflor');
var form = new FormData(myForm);
$.ajax({
type: "POST",
url: "functions/salvarFlor.php",
data: form,
cache: false,
contentType: false,
processData: false,
success: function(data) {
if (data == 'ok'){
alert('Dados salvos com sucesso!');
listaFlor();
}else{
alert(data);
}
}
});
}
The point is that if the user jumps line to organize the information, when I saved in the database "insert into flor (informacoes) values ('".$informacoes."')";
line breaks are lost...
How to save data from textarea
with the line breaks?