Powered By Blogger

Monday, April 13, 2015

Simple PHP contact form with process on same page

<?php
        if($_POST['Email_address']){
   
        $to = "Your Email Address";
        $from =  $_POST["Email_address"];
        $message = "&nbsp;&nbsp;&nbsp;&nbsp;<strong>First Name: </strong>".$_POST["Your_name"]."<br />";
        $message .= "&nbsp;&nbsp;&nbsp;&nbsp;<strong>Email: </strong>".$_POST["Email_address"]."<br />";
        $message .= "&nbsp;&nbsp;&nbsp;&nbsp;<strong>Contact number: </strong>".$_POST["Contact_number"]."<br />";
        $message .= "&nbsp;&nbsp;&nbsp;&nbsp;<strong>Message: </strong>".$_POST["Message"]."<br />";
        $subject = 'Contact Us';       
        $headers = "From: ".$_POST["Email_address"]."\n";
        $headers .= "MIME-Version: 1.0" . "\r\n";
        $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
       
        $send =    mail($to,$subject,$message,$headers);



        if($send)
        {
            echo "success";
        }
        else
        {
            echo "error";
            }
        }

       
        ?>

No comments:

Post a Comment

Contributors