I have <textarea class="form-control" id="informacoes" name="informacoes" rows="3" placeholder="descreva aqui..."></textarea>
where the user can enter various information.
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 issue is that if the user skips the line to organize the information, when I save on the "insert into flor (informacoes) values ('".$informacoes."')";
database the line breaks are lost ...
How can I save the data of textarea
with line breaks?