Tweet

Tuesday, 20 March 2012

Mail Form


if(isset($_REQUEST['submit'])){
  $location=$_SERVER['HTTP_REFERER'];
  $cleanedFrom = $_REQUEST['name'];


$to ='sonia@intiger.in';
$subject = 'Contact Us';

$headers = "From: " . $cleanedFrom . "\r\n";
       $headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

$message= '<html><body>';

  $message .= '<table rules="all" style="border-color: #E3E3E3;" cellpadding="10" width="450">';
$message .= "<tr style='background: #0268aa; color: #989898;'><td colspan='2'><strong>Path Lab</strong></td></tr>";
$message .= "<tr><td><strong>Name:</strong> </td><td>" .$_POST['name'] . "</td></tr>";
$message .= "<tr><td><strong>Email:</strong> </td><td>" . $_POST['email'] . "</td></tr>";
$message .= "<tr><td><strong>Phone:</strong> </td><td>" . $_POST['phone'] . "</td></tr>";
   $message .= "<tr><td><strong>Comment:</strong> </td><td>" . $_POST['comment'] . "</td></tr>";


   $message .= "<tr style='background: #0268aa;'><td colspan='2'>&nbsp;</td></tr>";
$message .= "</table>";
$message .= "</body></html>";


           
      $send =    mail($to, $subject, $message, $headers);

if($send)
{
echo "<script> alert('Message Sent. Thank you') </script>";
echo "<script> window.location = 'contact_us.php' </script>";
}

else
{
echo "<script> alert('Message Not Sent. Please try again') </script>";
echo "<script> window.location = 'contact_us.php' </script>";
}
     }    

No comments:

Post a Comment