anakadote wrote:correct. good luck!
Hey there - I just tested out the code and the form hangs on the PHP script. It doesnt send the mail or redirect to the thanks.html page - it just sits on a blank page with no error message.
Could you show me what the problem could be? Do I need to code in an SMTP server?
<?php
$redirectURL = "thanks.html";
if ($_POST['submit'] == TRUE) {
$name = stripslashes(strip_tags($_POST['FromName']));
$email = stripslashes(strip_tags($_POST['FromEmail']));
$subject = stripslashes(strip_tags($_POST['Subject']));
$to = stripslashes(strip_tags($_POST['ToAddress']));
$msg = stripslashes(strip_tags($_POST['Message']));
$ip = $_SERVER['REMOTE_ADDR'];
/ Set the email addresses in the drop down list here /
if ($_POST['ToAddress'] == 'option1'){
$mailto = 'email1@domain.com';
} else if ($_POST['ToAddress'] == 'option2'){
$mailto = 'email2@domain.com';
} else if ($_POST['ToAddress'] == 'option3'){
$mailto = 'email3@domain.com';
} else if ($_POST['ToAddress'] == 'option4'){
$mailto = 'email4@domain.com';
} else if ($_POST['ToAddress'] == 'option5'){
$mailto = 'email1@domain.com';
} else if ($_POST['ToAddress'] == 'option6'){
$mailto = 'email1@domain.com'
} else if ($_POST['ToAddress'] == 'option7'){
$mailto = 'email1@domain.com';
} else if ($_POST['ToAddress'] == 'option8'){
$mailto = 'email1@domain.com';
$msgformat = "From: $name ($ip)\nEmail: $email\nMessage For: $to\n\nMessage: $msg";
if(!mail($mailto, $subject, $msgformat, "From: $name <$email>")) {
echo "<h2>Error sending e-mail!</h2> <p>Please <a href='index.html'>try again</a></p>.";}
else { header("Location: ".$redirectURL); } }
}
?>