HI
I am very new at learning php, but i did this form tutorail a few days ago. The form appears to be working properly but i do not get any e-mails. The mail function is there and i do not get any errors when i click submit, just no e-mails. Can someone please point out where the error is. Thank you in advance.
<?php
// Function to display form
function showForm($errorName=false,$errorEmail=false){
if ($errorName) $errorTextName = “Please enter your name!”;
if ($errorEmail) $errorTextEmail = “Please enter a valid email address!”;
echo ‘<form action=”form.php” method=”POST”><table>’;
// Display name field an error if needed
echo ‘<tr><td>Name:</td><td><input type=”text” name=”name”></td></tr>’;
if ($errorName) echo “<tr><td colspan=’2′>$errorTextName</td></tr>”;
// Display email field an error if needed
echo ‘<tr><td>Email:</td><td><input type=”text” name=”email”></td></tr>’;
if ($errorEmail) echo “<tr><td colspan=’2′>$errorTextEmail</td></tr>”;
echo ‘<tr><td><input type=”submit” name=”SubmitForm” value=”Send”></td></tr>’;
echo ‘<form>’;
}
if(isset($_POST[‘submit’])) {
$to = “[email protected]”;
mail($to, $subject, $body);
} else {
//Init error variables
$errorName = false;
$errorEmail = false;
$name = isset($_POST[‘name’]) ? trim($_POST[‘name’]) : ”;
$email = isset($_POST[’email’]) ? trim($_POST[’email’]) : ”;
if (!eregi(“^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$”, $email)) $errorEmail = true;
if (strlen($name)<3) $errorName = true;
// Display the form again as there was an error
if ($errorName || $errorEmail) {
showForm($errorName,$errorEmail);
} else {
echo ‘Submission was success!’;
echo “<meta http-equiv=’refresh’ content=’0;url=http://www.iheartvacation.com’>”;
}
}
?>