I'm a front-end designer, so my PHP skills are pretty basic. For my personal portfolio, I want to make a contact form which sends a message straight to my gmail address. I'm having trouble making this happen. Here's my code:
<?php
error_reporting(0);
$action=$_REQUEST['action'];
if ($action=="") {
?>
<form action="" method="POST" enctype="multipart/form-data">
<h2>Form</h2>
<input type="hidden" name="action" value="submit">
<input name="name" type="text" value="" placeholder="Name"/><br>
<input name="email" type="text" value="" placeholder="Email"/><br>
<textarea name="message" placeholder="Message"></textarea><br>
<input name="cv" checked="true"> Yes, I would like to receive ****'s resume.<br>
<input type="submit" value="Send"/>
</form>
<?php
} else {
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$message=$_REQUEST['message'];
$cv=$_REQUEST['cv'];
if (($name=="")||($email=="")||($message=="")) {
echo "All fields are required. Please return to the <a href=\"\">form</a>.";
} else {
$from="From: $name<$email>
Return-path: $email";
$subject="New message sent from your form";
$curriculum="";
if(isset($_REQUEST['cv'])){
$curriculum="(!) This person would like to receive my resume.";
}
$cmessage=$message . "
" . $curriculum;
mail("my-email@gmail.com", $subject, $cmessage, $from);
echo "Message sent!";
}
}
?>
I'm not getting an email whenever I try filling out the form myself. What seems to be the problem?