0

I honestly can't find out what is wrong with the code. Could someone please help? I just want it to send the input to my email. And yes, it an email associated with my host.

The PHP:

<?php

if (isset($_POST['submit'])) { .  

  $name = $_POST['name'];   
  $mailFrom = $_POST['mail'];   
  $message = $_POST['message'];   

  $mailTo = "my@email.com";   
  $headers = "De: " .$mailfrom;   
  $txt = "Você recebeu um email de ".$name.".\n\n".$message;   

  mail($mailTo, $subject, $txt, $headers);
  header("Location: index.php?mailsend");

}

The HTML:

        <form id="contact" action="contactform.php" method="post">

            <h3>Deixe a sua mensagem.</h3>

            <input placeholder="Seu Nome" name="name" type="text" tabindex="1" required autofocus oninvalid="this.setCustomValidity('Favor digitar nome válido.')" oninput="setCustomValidity('')">

            <input placeholder="Seu E-Mail" name="mail" type="email" tabindex="2" required oninvalid="this.setCustomValidity('Favor digitar Email válido.')" oninput="setCustomValidity('')">

            <textarea placeholder="Digite sua mensagem aqui..." tabindex="5" name="message" required oninvalid="this.setCustomValidity('Favor digitar mensagem válida.')" oninput="setCustomValidity('')"></textarea>

            <button name="submit" type="submit" id="contact-submit" data-submit="...Sending">ENVIAR</button>

        </form>

Yeah it's a mess, sorry about that.

1 Answers1

0

what is that .?

if (isset($_POST['submit'])) { . <--------

I would try removing that period. Unless it's a speck on my monitor. haha!

If that isn't the problem, then it could be your smtp settings aren't set properly

  • I got happy for a moment, but then realized the . isn't in the code I uploaded. Probably added it here by mistake somehow. – Lucas L. C Jul 19 '18 at 20:50