I'm creating a message using the Sweet Alert feature, and where I need to display the person name inside an Alert from a PHP variable >. So, I would like to know how I can do it correctly.
Obs :. The connection to the database is working perfectly.
echo "<script>
swal({
title: 'Usuário Cadastrado.',
text: 'Gostaria de cadastrar os documentos do usuário **<?php echo $usuario ['nome']?>**?',
type: 'success',
cancelButtonText: 'Cancelar',
showCancelButton: true,
confirmButtonColor: '#00c292',
confirmButtonText: 'Sim, Cadastrar',
closeOnConfirm: true
}, function(){
window.location.href = 'novo_usuario';
});
</script>";
}
?>
Notice that on the line I reported the PHP code
text: 'Gostaria de cadastrar os documentos do usuário **<?php echo $usuario ['nome']?>**?',