I'm working on a personal portfolio website (www.corybolles.com) and I'm attempting to create a contact from based off of PHP. I have very little knowledge of PHP compared to HTML and CSS, and I was wondering if anyone could help me figure out why this is not working correctly.
HTML
<div id="contact">
<form action="contact.php" method="post">
<label>Name</label><br>
<input class="forminput" type="text" name="cf_name" width="50px"><br>
<label>Email</label><br>
<input class="forminput" type="text" name="cf_email" width="50px"><br>
<label>Message</label><br>
<textarea class="forminput" name="cf_message" cols="18" rows="10"></textarea><br>
<input class="formbutton" type="submit" name="submit"value="Send">
<input class="formbutton" type="reset" name="clear" value="Clear">
</form>
</div>
PHP
<?php
$name = $_POST['cf_name'];
$email = $_POST['cf_email'];
$message = $_POST['cf_message'];
$from = 'From: www.corybolles.com';
$to = 'jcbollesjr@gmail.com';
$subject = 'Message from user via www.corybolles.com';
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
?>
<?php
if ($_POST['submit']) {
if (mail ($to, $subject, $body, $from)) {
echo '<p>Thanks! Your message has been sent!</p>';
} else {
echo '<p>Sorry, something appears to have broken. Please try again</p>';
}
}
?>
You can test it yourself, but whenever I fill out the form to test it, it returns a successful message, however doesn't actually send anything.