Search This Blog

Wednesday, February 9, 2011

Contact form code very easy

<?php


if(isset($_POST['submit']))
    {
   
       
           
           
            $email='niravpanchal29@gmail.com';
            $subject ="Contact from your site name" ;
            $body = "<table>";
            $body .= "<tr><td>Name </td><td>:- ".$_POST['first_name']." ".$_POST['last_name']."</td></tr>";
            $body .= "<tr><td>Phone </td><td>:- ".$_POST['phone']."</td></tr>";
            $body .= "<tr><td>Alt Phone </td><td>:- ".$_POST['altphone']."</td></tr>";
            $body .= "<tr><td>Zip</td><td>:- ".$_POST['zip']."</td></tr>";
            $body .= "<tr><td>HomeOwner?</td><td>:- ".$_POST['HomeOwner']."</td></tr>";
            $body .= "</table>";
                       
            $headers  = 'MIME-Version: 1.0' . "\r\n";
            $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
            $headers .= 'From:niravpanchal29@gmail.com  <niravpanchal29@gmail.com>' . "\r\n";
            mail($email, $subject, $body, $headers);
           
           
            echo '<script>    window.location="thankyou.html"
                            </script>';
                           
           
       
    }

?>


And put this code in thank you.html page

  <script type="text/JavaScript">
setTimeout("location.href = 'index.php';",5000);
  </script>
</head>

<body>
<div align="center">
<p
 style="color: rgb(102, 102, 102); font-weight: bold; font-size: large;">Thank
you
very much for contacting us. <br>
We will be in touch with you soon. </p>
</div>

No comments:

Post a Comment