I am having problems with setting up a PHP for a form on a website, the problem is that I do not receive the data that I am putting into each input. I wanted to know if it is well armed or if I have to take into account something to be able to perform this test. On the other hand, may it be possible that I have to configure something in my email account to get them to me? Because I test with several accounts and nothing happens.
<?php
$remitente = $_POST['email'];
$destinatario = '[email protected]'; // en esta línea va el mail del destinatario, puede ser una cuenta de hotmail, yahoo, gmail, etc
$asunto = 'Consulta Bricsa'; // acá se puede modificar el asunto del mail
if (!$_POST){
?>
<?php
}else{
$cuerpo = "Nombre: " . $_POST["nombre"] . "\r \n";
$cuerpo .= "Empresa: " . $_POST["empresa"] . "\r \n";
$cuerpo .= "Email: " . $_POST["email"] . "\r \n";
$cuerpo .= "Telefono: " . $_POST["telefono"] . "\r \n";
$cuerpo .= "Consulta: " . $_POST["consulta"] . "\r\n";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=utf-8\n";
$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: \"".$_POST['nombre']." ".$_POST['empresa']."\" <".$remitente.">\n";
mail($destinatario, $asunto, $cuerpo, $headers);
include 'confirmacion.html'; //se debe crear un html que confirma el envío
}
?>
<form role="form" action="contacto.php" method="post">
<input maxlength="100" required="required" class="form-control" placeholder="Nombre y Apellido" type="text" name="nombre" />
<input maxlength="100" type="text" required="required" class="form-control" placeholder="Empresa" type="text" name="empresa" />
<input maxlength="100" required="required" class="form-control" type="email" name="email" placeholder="Email" id="contact-email" />
<input maxlength="100" type="text" required="required" class="form-control" placeholder="Teléfono" name="telefono" />
<textarea class="form-control" name="consulta" maxlength="1200" rows="4" placeholder="Dejanos tu consulta..."></textarea>
<input class="btn" type="submit" name="" value="ENVIAR">
</form>