"edo" is not defined

3

Good morning, I present my problem. I happen to see this error at the time of starting:

  

Notice: Undefined index: edo in C: \ xampp \ htdocs \ sendMail.php on line 10.

And I do not know why it is, nor how to solve it I would appreciate any possible solution.
It is very urgent please.                         

<body>
<?php
if($_POST['edo']){
    $nombre = $_POST['nombre'];
    $apellido = $_POST['apellido'];
    $correo = $_POST['correo'];
    $comentario = $_POST['comentario'];
    if($nombre==""){
        print "El nombre es obligatorio<br>";
    } else if($apellido == ""){
        print "El apellido es obligatorio<br>";
    } else if($correo == ""){
        print "El correo es obligatorio<br>"; 
    }  else if($comentario == ""){
        print "El comentario es obligatorio<br>";
    } else {
        $mail = "[email protected]";
        $mensaje = "$nombre $apellido ha enviado un mail.<br>";
        $mensaje .= "Su mail es $correo y su mensaje es:<br>";
        $mensaje .= $comentario;

        $headers = "MIME-Version: 1.0\r\n"; 
        $headers .= "Content-type:text/html; charset=UTF-8\r\n"; 
        $headers .= "From: ".$_POST['correo']."\r\n"; 
        $headers .= "Repaly-to: $correo\r\n";

        $asunto = "$nombre $apellido ha enviado un mail";

        if(mail($mail, $asunto, $mensaje,$headers)){
            print "Su comentario ha sido enviado exitosamente<br>";
        } else {
            print "Error en el envío de su correo, intentarlo más tarde<br>";
        }

    }

} else {
?>
<form method="post" action="enviaMail.php">
Nombre: <input type="text" name="nombre"/><br />
Apellido:<input type="text" name="apellido"/><br />
Correo: <input type="text" name="correo"/><br />
Comentario: <br />
<textarea name="comentario" cols="50" rows="6" wrap="off"></textarea>
<br />
<input type="submit" value="Enviar" />
<input type="hidden" value="1" name="edo" />
</form>
<?php } ?>
</body>
</html>
    
asked by Gianni Esquivel 17.09.2017 в 04:55
source

1 answer

1

The variable edo is not defined.

if(isset($_POST['edo'])){
    // tu codigo
}else{
    // tu codigo
}

With that your problem should be solved.

    
answered by 17.09.2017 / 05:02
source