This is the code for my contact form, its pretty short, the site uses java and php, if that matters to mention. Anyways, "Email" and "Name" fields need to be optional, but it will not send unless they are filled, what needs to be changed down below? (Im not a good php guy, so example or copying it in your answer will help) thanks!
<?php
error_reporting(0);
$from = 'NewFeedBack@ReviewBM.com';
$to = 'Mike@gmail.com';
if ($_POST['sender_subject'] and $_POST['sender_message'] and $_POST['sender_name'] and $_POST['sender_email']) {
$message = "Complainers email: " . $_POST['sender_email'] . "
Complainers name: " . $_POST['sender_name'] . "
Complainers message: " . $_POST['sender_message'] . "
";
$headers .= "From:" . $from;
mail($to, $_POST['sender_subject'], $message, $headers);
$data = array('status'=>0);
echo(json_encode($data));
}else{
$data = array('status'=>1);
echo(json_encode($data));
}
return;