So I am a networking student that is working with designing and building web pages. I installed LAMP on a home PC so that I can have a webserver at home. So I am somewhat new to server side things. So I am building a website and found the great idea of doing a contact form instead of using the "mailto" idea. So I found a site that had a good and easy way to install a contact form with a contact_form.html & contact.php files. So I put them in my /var/www/ folder along with all of my other website material. When I put localhost into the URL and the site comes up, I click on the email contact link and the contact_form.html page comes up. I fill in the info and click on send, but it comes up with Message Failed error. I am new to this somewhat and would like someone to look through the code from both files. When I installed LAMP, I was under the assumption that it was PHP compatable when I have a .php file in the /var/www/ folder. Any info would be great!
Kris
<?php
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_message = $_POST['cf_message'];
$mail_to = 'hornerkris@gmail.com';
$subject = 'Message from a site visitor '.$field_name;
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Message: '.$field_message;
$headers = 'From: '.$cf_email."\r\n";
$headers .= 'Reply-To: '.$cf_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
	<script language="javascript" type="text/javascript">
		alert('Thank you for the message. We will contact you shortly.');
		window.location = 'contact_page.html';
	</script>
<?php
}
else { ?>
	<script language="javascript" type="text/javascript">
		alert('Message failed. Please, send an email to hornerkris@gmail.com');
		window.location = 'contact_page.html';
	</script>
<?php
}
?>
<!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>
<form action="contact.php" method="post">
	Your name<br>
    <input type="text" name="cf_name"><br>
	Your e-mail<br>
    <input type="text" name="cf_email"><br>
	Message<br>
    <textarea name="cf_message" Rows=20 Cols=100></textarea><br>
	<input type="submit" value="Send">
	<input type="reset" value="Clear">
</form>
</body>
</html>