My php form mailer script doesn't work

I can’t seem to get my php email form to work. All i want is email me the contents of my form. There are 7 fields that needs to be validated in the form. It neither sends me an email, nor re-direct to the thank you page.

The form’s “action” setting goes to the mail.php, on which the code reads (originally copied from the tutorial & adjusted for my own use):

<? if (!empty($_POST['FName'])){ $msg = "FName; $_POST[FName] "; }else{ $FName = NULL; echo "Please enter your first name.
"; } if (!empty($_POST['LName'])){ $msg .= "LName: $_POST[LName] "; }else{ $LName = NULL; echo "Please enter your last name.
"; } if (!empty($_POST['Address'])){ $msg .= "Address: $_POST[Address] "; }else{ $email = NULL; echo "Please enter your ddress.
"; } if (!empty($_POST['Apt'])){ $msg .= "Apt: $_POST[Apt] "; }else{ $apt = NULL; echo "Please enter your apt. #.
"; } if (!empty($_POST['City'])){ $msg .= "City: $_POST[City] "; }else{ $City = NULL; echo "Please enter your city.
"; } if (!empty($_POST['Phone1'])){ $msg .= "Work Phone: $_POST[Phone1] "; }else{ $Phone1 = NULL; echo "Please enter your work phone.
"; } if (!empty($_POST['Phone2'])){ $msg .= "Home or Cell Phone: $_POST[Phone2] "; } if (!empty($_POST['Message'])){ $msg .= "Repairs Requested: $_POST[Message] "; }else{ $Message = NULL; echo "Please enter your repair request.
"; } $to = "[email protected]"; $subject = "Online Service Request Form"; $headers = "From: [email protected]"; //send the mail mail($headers, $to, $subject, $msg, ); // display the thank you page header("Location: thankyou.html"); ?>

Hi there,

I literally just quickly scanned your message, but I believe your problem lies with the mail() function, it should be:

Sponsor our Newsletter | Privacy Policy | Terms of Service