mercredi 5 avril 2017

PHP Sucess message after submit

Im using a simple php code to send mail from my website

    <?php 

    $headers ="From:<$from>\n";
    $headers.="MIME-Version: 1.0\n";
    $headers.="Content-type: text/html; charset=iso 8859-1";

    mail($to,$subject,$body,$headers,"-f$from");


    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];
    $formcontent="From: $name \n Message: $message";
    $recipient = "contato@pedrogps.com";
    $subject = "Contact Form";
    $mailheader = "From: $email \r\n";
    mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
    echo "Thanks for your message";
    ?>

when i submit the email, it brings to another page (mail.php) with the "thanks for your message" message.

What can i do to display this message inside my html page without switching pages.

Aucun commentaire:

Enregistrer un commentaire