Tuesday 9 September 2014

Feedback / Contact form using php email concept

it is based on Email template, here we are going to create a feedback and contact form using php email concept,  user friendly php email template. when we are using sending email from the website, the mail should go to the admin of the website. i.e. the visitor feedback or contact details submission on the website to website admin enquiry.

Feedback form
DOWNLOAD         LIVE DEMO

as you can see in the above image, the email is from visitor to admin of the website. let see the coding of it.

HTML FORM CODE

index.php
<div class="container">
  <form action="email.php" method="post">
    <p>
      <input type="text" required placeholder="Enter your firstname" name="firstname" />
    </p>
    <p>
      <input type="text" required placeholder="Enter your lastname"  name="lastname" />
    </p>
    <p>
      <input type="email" required placeholder="Enter your email"     name="email" />
    </p>
    <p>
      <input type="text" required placeholder="Enter your number"    name="number" />
    </p>
    <p>
      <textarea name="feedback" required placeholder="Enter your Feedback" ></textarea>
    </p>
    <p>
      <input type="submit" name="send" value="Submit your Request">
    </p>
  </form>
</div>


PHP CODE FOR THE MAIL

email.php
<?php
if(isset($_POST['send']))
{
   extract($_POST); 
    $to="xxxx@gmail.com"; //change to ur mail address
    $strSubject="Feedback of 1Next2";           
    $message .= "<html>\n";
    $message .= "<body>
    <div>Dear ".$firstname.",<div>
    <table collspan=\"5\">
    <tr>
        <td colspan='3'>Feedback from visitors</td>
    </tr>
    <tr>
        <td>Firstname</td>
        <td>: </td>
        <td><strong>".$firstname."</strong></td>
    </tr>
    <tr>
        <td>Lastname</td>
        <td>: </td>
        <td><strong>".$lastname."</strong></td>
    </tr>
    <tr>
        <td>Email-id</td>
        <td>: </td>
        <td><strong>".$email."</strong></td>
    </tr>
    <tr>
        <td>Contact Number</td>
        <td>: </td>
        <td><strong>".$number."</strong></td>
    </tr>
    <tr>
        <td>Message</td>
        <td>: </td>
        <td><strong>".$feedback."</strong></td>
    </tr>   
    </table>
    ";
    $message .= "</body>\n";    
    $headers = 'MIME-Version: 1.0'."\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
    $headers .= "From: info@1next2.blogspot.com"; 
    $mail_sent=mail($to, $strSubject, $message, $headers);  
    if($mail_sent)
        echo "<script>alert('Thank you. we will get back to you'); window.location='index.php';exit();</script>";
    else
        echo "<script>alert('Sorry.Request not send'); window.location='index.php';exit();</script>";
}
?>

We hope this post is really helpful to you.. thank you.

8 comments:

  1. How to build a luxury car with the cost of titanium
    The cost of titanium wedding ring titanium is not titanium cost that much, but a factor we consider 개집 왕 is in the price. In microtouch titanium order to get the best value, you titanium nitride gun coating need to make your car with the best value.

    ReplyDelete

© All rights reserved @ 1next2.com