0
I made a short form to test the mail function, the email is being sent but arrives with the name and message fields blank. I saw other forums and they indicate other libraries but wanted to know what I’m missing.
<form action="enviar.php" method="post">
<label for="nome">Nome:</label>
<input type="text" name="nome" required><br><br>
<label for="email">Email:</label>
<input type="email" name="email" required><br><br>
<label for="mensagem">Mensagem:</label>
<textarea name="mensagem"></textarea><br><br>
<input type="submit" name="enviar" value="Enviar">
</form><!-- FORM -->
PHP
<?php
$nome = $_POST['nome'];
$email = $_POST['email'];
$mensagem = $_POST['mensagem'];
$titulo = 'Email Curso PHP';
$dest = '[email protected]';
$dados = 'Nome :'.$nome." Email: ".$email." Destinatário: ".$dest." Mensagem: ".$mensagem;
mail($dest, $titulo, $dados);
?>
Checked if the values are correctly arriving in
$_POST
?– Woss
Yes, but I managed to make it work by putting everything get. It’s correct this way?
– Leonardo Henrique