1. Buat file sendemail.php dengan kode dibawah ini dan upload ke hosting, misal http://sekolahbahasaeropa.com/sendemail.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sendemail Script</title>
</head>
<body>
<!-- Reminder: Add the link for the 'next page' (at the bottom) -->
<!-- Reminder: Change 'YourEmail' to Your real email -->
<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$visitorphone = $_POST['visitorphone'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];
if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}
if(empty($visitor) || empty($visitormail) || empty($visitorphone) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}
$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ;
$subject = $visitor;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n
Minat Bahasa: $attn \n
Message: $notes \n
From: $visitor ($visitormail) ($visitorphone)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";
$from = "From: $visitormail\r\n";
mail("des@sekolahbahasaeropa.com", $subject, $message, $from);
?>
<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> ) ( <?php echo $visitorphone ?> )
<br />
Minat Bahasa: <?php echo $attn ?>
<br />
Message:<br />
<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
<?php echo $ip ?>
<br /><br />
<a href="http://des.sekolahbahasaeropa.com"> Next Page </a>
</p>
</body>
</html>
2. Copy dan paste kode berikut pada new post
<form action="http://sekolahbahasaeropa.com/sendemail.php" method="post">
Your Name:
<input name="visitor" size="40" type="text" />
Your Email:
<input name="visitormail" size="40" type="text" />
Your Phone Number:
<input name="visitorphone" size="40" type="text" />
Minat Bahasa:
<select name="attn" size="1"> <option value=" Jerman ">Jerman </option><option value=" Prancis ">Prancis </option><option value=" Inggris ">Inggris </option><option value=" Belanda ">Belanda </option><option value=" Korea ">Korea </option><option value=" Spanyol ">Spanyol </option><option value=" Arab ">Arab </option><option value=" Mandarin ">Mandarin </option><option value=" Jepang ">Jepang </option> <option value=" Indonesia ">Indonesia </option></select>
Mail Message:
<textarea cols="55" name="notes" rows="8"></textarea>
<input type="submit" value="Send Mail" />
</form>
Catatan :
Ganti dan sesuaikan tulisan yang berwarna merah dengan alamat hosting anda.
Ganti Tulisan yang berwarna biru dengan alamat web atau blog anda
You are here: Home / / Cara Membuat Contact Form di Blog
Cara Membuat Contact Form di Blog
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment