Contact Form Inbox

<?php 
$errors = '';
$myemail = 'me@hikmal.web.id';//<-----Put Your email address here.

if(empty($_POST['name'])){
$errors .= "\n Error: all fields are required";
}


$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];

if( empty($errors)){
$to = $myemail;
$email_subject = "Contact form submission: $name";
$email_body = "

<html>
<head></head>
<body>

<h2>Enquiry From $name</h2>
<hr style='width:100%'>

<table width='100%'>
<tr>
<td width='20%'>Name</td>
<td>: $name</td>
</tr>

<tr>
<td>Email</td>
<td>: $email</td>
</tr>

<tr>
<td>Subject</td>
<td>: $subject</td>
</tr>

<tr>
<td>Message</td>
<td>: $message</td>
</tr>
</table>

</body>
</html>";

$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
$headers[] = 'From: hikmal.web.id';

mail($to,$email_subject,$email_body,implode("\r\n", $headers));
header('Location: contact_us.php');
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Contact form handler</title>
</head>
<body>
<?php
echo nl2br($errors);
?>
<br>
<a href="#">Back</a>
</body>
</html>

Tinggalkan Komentar

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *

×