form php error [closed]

0

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); 


?> 
    
asked by Natalia Beltran 04.02.2018 в 18:30
source

3 answers

2

Yes:

<input type="text" name="Nombre" data-new-placeholder="Nombre" class="form-control label_better" placeholder="Nombre"required>

Then:

$nombre = $_POST['Nombre'];

And no:

$nombre = $_POST['nombre'];

Variables are case-sensitive.

    
answered by 04.02.2018 в 18:37
0

Amiga and the name of

<textarea class="form-control label_better" placeholder="Envianos tu consulta" rows="7"></textarea>

You're supposed to receive it in $_POST["mensaje"];

    
answered by 04.02.2018 в 18:33
0

The data does not arrive because the name of the inputs are different, you collect $_POST['nombre'] , but send Nombre have to be equal in both upper and lower case

    
answered by 04.02.2018 в 19:00