Good people. When I opened my web page, I was sent an email with the empty php contact form. When really what I want is that by clicking on send the contact form I get the email with the entered data. I leave my html and the php to see if anyone can help me find the error.
html
<form class="form-horizontal" action="../enviarcorreo.php" method="post">
<div class="form-group">
<div class="col-sm-4" style="position:relative">
<input type="text" name="Nombre" data-new-placeholder="Nombre" class="form-control label_better" placeholder="Nombre"required>
</div>
<div class="col-sm-4">
<input type="text" name="Email" class="form-control label_better" placeholder="Email"required>
</div>
<div class="col-sm-4">
<input type="text" name="Telefono" class="form-control label_better" placeholder="Telefono"required>
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<textarea class="form-control label_better" placeholder="Envianos tu consulta" rows="7"></textarea>
</div>
</div>
<div class="form-group commands">
<button class="btn btn-primary" >Enviar Consulta</button>
</div>
</form>
php
<?php
if(!isset($_POST['btn btn-primary']))
$nombre = $_POST['nombre'];
$email = $_POST['email'];
$telefono = $_POST['telefono'];
$header = 'From: ' . $email . " \r\n";
$header .= "X-Mailer: PHP/" . phpversion() . " \r\n";
$header .= "Mime-Version: 1.0 \r\n";
$header .= "Content-Type: text/plain";
$mensaje = "Este mensaje fue enviado por " . $nombre . ", telefono: " . $telefono . " \r\n";
$mensaje .= "Su e-mail : " . $email . " \r\n";
$mensaje .= "Mensaje: " . $_POST['mensaje'] . " \r\n";
$mensaje .= "Fue enviado... " . date('d/m/Y', time());
$para = "[email protected]";
$asunto = 'ASUNTO DEL MENSAJE';
mail($para, $asunto, utf8_decode($mensaje), $header);
?>