I am having a difficult time processing a php contact form. Below is the html code and php script.
[code]
Your Name:
Your Email:
Your Message:
[php]<?php
if (isset($_POST[‘name’]) && isset($_POST[‘email’]) && isset($_POST[‘message’])) {
$name = $_POST[‘name’];
$email = $_POST[‘email’];
$message = $_POST[‘message’];
if (!empty($name) && !empty($email) && !empty($message)) {
$to = '[email protected]';
$subject = 'Onedollarpic Message.';
$body = '$name."\n".$message';
$headers = 'From:'.$email;
if (mail($to, $subject, $body, $headers)) {
echo 'Thanks for contacting us.';
} else {
echo 'Sorry, an error has occurred. Please try again later';
}
} else
{
echo “All fields are required.”;
}
?>
[/php]
HTML form is on a separate page than the php script. What can you tell is wrong in the above code?
Appreciate your help.