Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The page shows you the problem</p> <blockquote> <p>Warning: Cannot modify header information - headers already sent by (output started at /home/jardines/public_html/xtatanx/contacto.php:57) in /home/jardines/public_html/xtatanx/contacto.php on line 70</p> </blockquote> <p>That means that the <code>mail</code> function needs to modify the HTTP headers but they have already been sent because you've already started outputting the HTML.</p> <p>You need to make sure you call <code>mail</code> before outputting any HTML</p> <pre><code>&lt;?php // At the top of the file, before any HTML is output $successfulMail = mail ($to, $subject, $body, $from); $nombre = $_POST['nombre']; $email = $_POST['email']; $numero = $_POST['telefono']; $mensaje = $_POST['mensaje']; $from = 'From: UsuarioStrategyResearch'; $to = 'jhonnatanhxc@gmail.com'; $subject = 'Contacto Strategy Research'; $body = "De: $nombre\n E-Mail: $email\n Movil: $numero\n Mensaje:\n $mensaje"; $mailMsg = ''; if ($_POST['enviar']) { // Here's the trick, can't call mail after HTML has been output if (mail ($to, $subject, $body, $from)) { $mailMsg ='&lt;p&gt;Tu mensaje ha sido enviado, pronto nos pondrémos en contacto.&lt;/p&gt;'; } else { $mailMsg ='&lt;p&gt;Ha habido un error y el mensaje no ha podido ser enviado.&lt;/p&gt;'; } } ?&gt; ... &lt;form method="post" action="contacto.php" id="form"&gt; &lt;label for="nombre"&gt;Nombre: &lt;/label&gt; &lt;input type="text" name="nombre" placeholder="Su nombre"/&gt; &lt;label for="correo"&gt;Correo electrónico: &lt;/label&gt; &lt;input type="email" name="email" placeholder="nombre@correo.com"/&gt; &lt;label for="numero-telefonico"&gt;Teléfono móvil: &lt;/label&gt; &lt;input type="text" name="telefono" placeholder="Introducir nº de telf" /&gt; &lt;label for="mensaje"&gt;Mensaje: &lt;/label&gt; &lt;textarea name="mensaje" cols="20" rows="6" placeholder="Escriba un mensaje breve..."&gt;&lt;/textarea&gt; &lt;input type="submit" id="enviar" name="enviar" value="Enviar"&gt; &lt;span id="respuesta"&gt;&lt;?php echo $mailMsg ?&gt; &lt;/span&gt; &lt;/form&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload