Your name:

Your email:

Your message:



INSTRUCTIONS:
This is a PHP file with HTML combined
It has to have only extension .php (not .html). You can link this file to your contact page (in an external window, with the nice button) instead of putting the form on the page
Notes:
- When the user clicks SUBMIT, the feedback “Thank you, mail sent” will appear on the same page
- Add some CSS
- Change these lines, otherwise it will go to my email:
$from_add = "form@ellenclass.com"; <-- put your server name here
$to_add = "ellenbaryshev@gmail.com"; <--put your email address here

COPY THE CODE BELOW AND INSERT IT INTO YOUR PHP FILE:
<?php
$msg="";
if(isset($_POST['submit']))
{
/* ****Important!****
replace form@ellenclass.com and ellenbaryshev@gmail.com below
with the site and an email address that belongs to the website where the script is uploaded.
*/
$from_add = "form@ellenclass.com"; //<-- put your server name here
$to_add = "ellenbaryshev@gmail.com"; //<-- put your email address here

//$subject = "Test Subject";
//$message = "Test Message";
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$message=$_REQUEST['message'];

$headers = "From: $from_add \r\n";
$headers .= "Reply-To: $from_add \r\n";
$headers .= "Return-Path: $from_add\r\n";
$headers .= "X-Mailer: PHP \r\n";

$body = "Name: ".$name." \r\n";
$body .= "Email: ".$email." \r\n";
$body .= "Message: ".$message;

if(mail($to_add,$subject,$body,$headers))
{
$msg = "Thank you, mail sent.";
}
else
{
$msg = "Error sending email!";
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PHP form</title>
</head>
<body>
<form action='<?php echo htmlentities($_SERVER['PHP_SELF']); ?>' method='post'>
Your name:<br>
<input name="name" type="text" value="" size="50"/><br>
Your email:<br>
<input name="email" type="text" value="" size="50"/><br>
Your message:<br>
<textarea name="message" rows="7" cols="38"></textarea><br>
<input type='submit' name='submit' value='Submit'>
</form>
<?php echo $msg ?>
</body>
</html>