samedi 25 novembre 2017

Contact form sending emails without name, email and message

I have a problem with a contact form I'm building because it sends the message without sender info (name & email) and no message as well. And I need that. I tried the "var_dump" from another post I found but did not work.

HTML

<form action="form_process.php" class="contact_form" method= "post" onsubmit>
<ul>
 <li><label for="name">name:</label><input type="text" required /></li>
<li><label for="email">email:</label><input type="email" name="email" required /></li>
<li><label for="message">message:</label><textarea name="message" cols="40" rows="6" required ></textarea></li>
<li><button class="submit" type="submit">Enviar</button></li>
</ul>
</form>
</div>

PHP

<?php

$name = var_dump($_POST['name']);
$email = var_dump($_POST['email']);
$message = var_dump($_POST['message']);
$to = "mmechenique@gmail.com";
$subject = "Nuevo mensaje formulario de contacto";

mail ($to, $subject, $message, "From: " . $name);
echo "Tu mensaje ha sido enviado, muchas gracias!";

?>




Aucun commentaire:

Enregistrer un commentaire