Social

Thursday, January 2, 2014

PHP Simple Contact Us Form


     In this post I’ll show how to design a contact us form using PHP language. And this can send the form details that the user types to any type of email.
     So first thing first. You needed to design the main page that contain the fields that you want to get from the user. And here my main page is main.html,
 <html>  
 <head>  
 <title>Cantact Us Form</title>  
 </head>  
 <body>  
 <form name='form' method='post' action="send_mail.php">  
      <input type="text" name="name" />  
      <input type="text" name="email"/>  
      <textarea name="msg" cols="85" rows="5" ></textarea>  
      <input type="submit" value="Submit" name="submit_email" />  
 </form>  
 </body>  
 </html>  

     Now when the user fill the form and hit Submit button, it will redirect to send_mail.php page, where the sending to your email part is handling. Here is the send_main.php,
 <?php  
 //Copyright © RockMan  
 $to = "rocknirmana@gmail.com"; //your email address  
       if(isset($_POST['submit_email']))  //CONTACT US  
       {  
            $name=$_POST['name'];  
            $email=$_POST['email'];  
            $msg=$_POST['msg'];  
                          $subject ="Request Form";   
                          $msg = "Name : " . $name . "<br/>" . "Request : " . $msg . "<br/>" ;  
                          $headers = "From: " . strip_tags($email) . "\r\n";  
                          ini_set('sendmail_from', 'me@example.com');  
                          $semi_rand = md5(time());   
                          $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";  
                          $headers .= "MIME-Version: 1.0\r\n";  
                          $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";  
                          $message = '<html><body>';  
                          $message .= $msg .'<br/>' ;  
                          $message .= '</body></html>';  
                     $ok = mail($to, $subject, $message, $headers);   
                     if(!$ok)  
                     {  
                          $_SESSION['error_ok'] = "Error in Sending your Email ! Please try again.";  
                     }  
                     else  
                     {  
                          header("Location: http://rocknirmana.blogspot.com"); //after success email send go to this page(this page can be a thank you page or something)  
                     }  
       }  
       else  
       {  
            header("Location: http://rocknirmana.blogspot.com"); //if someone dirrectly go to this page  
       }  
 ?>  
     Here this PHP page get the details using POST method and arrange them according to some order and send that to the email that is given above. So it’s just simple as 123. And if you have any misunderstanding don’t hesitate to contact me.\m/



1 comment:

  1. Php Simple Contact Us Form - Rocknirmana >>>>> Download Now

    >>>>> Download Full

    Php Simple Contact Us Form - Rocknirmana >>>>> Download LINK

    >>>>> Download Now

    Php Simple Contact Us Form - Rocknirmana >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete

 

Search This Blog

Most Reading

Protected by Copyscape Duplicate Content Software

Facebook Page