Sell And Buy

Sunday 1 February 2015

How to Sent Email in Tabular Form Using PHP.

 <?php
 $hotels=$_POST['rtype'];
$name=$_POST['name'];
$email=$_POST['email'];
$contact=$_POST['contact'];
$message=$_POST['message'];



//$subject = 'Email from' . $name;
//$message1 = 'hello';
$to = 'demo@email.com';
$subject = 'My Website Contact Info';

$msg = "<html>
<head>
<title>Contact Info</title>
</head>

<body>
<p align='center'> <img src='#' width='210' height='45'> </p>

<table cellspacing=\"4\" cellpadding=\"4\" border=\"1\" align=\"center\">
 
  <tr>
  <td align=\"center\">Room Type</td>
  <td align=\"center\"> Name</td>
  <td align=\"center\">Email</td>
  <td align=\"center\">Contact Number</td>
  <td align=\"center\">Message</td>
  </tr>
 
  <tr>
  <td align=\"center\">$hotels</td>
  <td align=\"center\">$name </td>
  <td align=\"center\">$email</td>
  <td align=\"center\">$contact</td>
  <td align=\"center\">$message</td>
  </tr>
 

 
</table>
</body>
</html>";

// Make sure to escape quotes

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Your Site Name <Your Website Information>' . "\r\n";

mail($to, $subject, $msg, $headers);

echo"<script>var msg='Thank you, We will get in touch with you very soon..';alert(msg);
window.location.href = 'index.php';
</script>";

?>

No comments:

Post a Comment