You not need to change the coding below, just change the value of $email to own email. This form will send you a email at $email(Value you fixed) address
<?php
error_reporting (E_ALL ^ E_NOTICE);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Contact form</title>
</head>
<body>
<?php
if ($_POST['submit']){
$email = "admin@naveenjain.webatu.com"; // enter your own email
$n = $_POST['name'];
$e = $_POST['email'];
$t = $_POST['telephone'];
$c = $_POST['country'];
$ci = $_POST['city'];
$a = $_POST['address'];
$comment = $_POST['comment'];
if ($n){
if ($e){
if ($t){
if ($c){
if ($ci){
if ($a){
if ($comment){
$webmaster = "$email";
$headers = "From: $n<$webmaster>";
$subject = "Mail from contact form";
$message = "You have got a mail from $n.<h2>User's Details</h2> <br />User's email is $e. Telephone number is $t. Country is $c and city is $ci and address is $a. His comment was $comment";
if (mail($e, $subject, $message, $headers)){
echo "Your message has been sent";
}
else
echo "Sorry, the message could not be sent please try again after sometime";
}
else
echo "enter your comment";
}
else
echo "Enter your address";
}
else
echo "enter your city";
}
else
echo "enter your country";
}
else
echo "enter your telephone";
}
else
echo "enter your email";
}
else
echo "Enter your name";
}
else
echo "<form action='' method='post'>
<table>
<tr>
<td>Name</td>
<td><input type='text' name='name' /></td>
</tr>
<tr>
<td>Email</td>
<td><input type='text' name='email' /></td>
</tr>
<tr>
<td>Telephone</td>
<td><input type='tel' name='telephone' /></td>
</tr>
<tr>
<td>Country</td>
<td><input type='text' name='country' /></td>
</tr>
<tr>
<td>City</td>
<td><input type='text' name='city' /></td>
</tr>
<tr>
<td>Your address</td>
<td><textarea name='address'></textarea></td>
</tr>
<tr>
<td>Comment</td>
<td><textarea name='comment'></textarea></td>
</tr>
<tr>
<td></td>
<td><input type='submit' value='Send us query' name='submit' /></td>
</tr>
</table></form>";
?>
</body>
</html>
0 comments:
Post a Comment