If what you want is to display the PHP variable message $msg
, you can do it two very simple ways:
Short:
<div class="mensagem"><?= $msg ?></div>
Traditional:
<div class="mensagem"><?php echo $msg; ?></div>
You can also do it using Javascript/Jquery, but I don’t see why you would do it in this example:
<div class="mensagem"></div>
Javascript:
<script>
document.querySelector('.mensagem').innerText = '<?= $msg ?>';
</script>
Jquery:
<script>
$('.mensagem').text('<?= $msg ?>');
</script>
You could see:
Video courses that can help you get started:
There are other courses besides these on his channel, this channel is great for those who are starting.
I couldn’t understand, what you want is to display the PHP variable
$msg
indiv
?– Vinícius Lima
It is not very clear what you are trying to do. I suggest you set an example closer to what you really need to do.
– Isac