PHP does not pick up HTML variables [closed]

1

I've just been introducing myself to the world of web development and I've been following several tutorials.

In this I find myself making a form to send an emial through a server (which in principle I have configured).

Does anyone know that it may be failing? In principle I have the same as the tutorial ...

HTML code

<form method = "post" action="enviaremail.php">
<h1> Contacto </h1> 
<label for ="nombre">Nombre: </label>
<input type ="text" name ="nombre" id ="nombre" placeholder="Introduce tu nombre"></br>

<label for="asunto">Asunto: </label>
<input type="text" name="asunto" id="asunto" placeholder="Asunto"></br>

<label for="correo">Correo electrónico: </label>
<input type="text" name="correo" id="correo" placeholder="Correo para recibir respuesta"></br>

<label for="mensaje">Mensaje: </label>
<textarea name="mensaje" id="mensaje" cols="30" rows="10" placeholder= "Escribe tu consulta"></textarea>
<br>
<input type="submit">
</form> 

PHP Code

<?php

    $nombre = $_POST['nombre'];
    $asunto = $_POST['asunto'];
    $correo = $_POST['correo'];
    $mensaje = $_POST['mensaje'];

    echo $nombre;
    echo $asunto;
    echo $correo;
?>

If I put the method in get, the URL that generates me is the following:

/enviaremail.php?nombre=David&asunto=Prueba&correo=prueba%40gmail.com&mensaje=Esto+es+una+prueba

When I open the inspect item after giving "Submit" I get this:

I have declared the following at the beginning of the HTML document:

<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 

I am using "Sublime Text 3":

    
asked by David_helo 29.08.2018 в 13:56
source

0 answers