HI Guys
I followed this tutorial on how to create a php form. The problem i have is that when i fill in the info and click send, everything appears well but the info is not being sent to the assigned e-mail. I’m not sure what is wrong. Hopefully someone can catch error. Your help is greatly appreciated.
[SIZE=2]<?php
error_reporting(E_ALL);
// 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="send" value="Submit"></td></tr>';
echo '<form>';
}
if ( isset($_POST["Submit"]) ) {
$email = $_POST[‘email’];
$subject = ‘your subject here’;
$message = ‘your message’;
$reply_to = ‘jnr1975@hotmail.com’;
$from = ‘you@yourdomain.com’;
mail( $email, $subject, $message, “From: {$from}
Reply-to: {$reply_to}” );
} 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 'Thamk you for signing up!';
echo "<meta http-equiv='refresh' content='0;url=http://www.iheartvacation.com'>";
}
}
?> [/SIZE]