I've got a contact form up and running, somewhat. The user input their info, and then the message in a text area named message. When they submit, it mails the data to me. However, despite the fact that the user has input text in the textarea, I get nothing in the email.
Here's the PHP:
...
if($HTTP_POST_VARS['message'] = "") {
echo "Error: no message";
}
else {
$message = $HTTP_POST_VARS['message'];
if(isset($HTTP_POST_VARS['mailinglist'])) {
$db_link = mysql_connect("localhost", "root")
or die("Could not connect : " . mysql_error());
mysql_select_db("mailinglist") or die("Could not select database");
$query = "INSERT INTO info VALUES ('NULL','".$HTTP_POST_VARS['senderEmail']."','".$HTTP_POST_VARS['senderName']."')";
$result = mysql_query($query, $db_link) or die("Query failed : " . mysql_error());
$message .= "\r\nI checked the boxed on the form indicating that I do not object to receiving your newsletter.";
}
}
$headers = "From: {$from}\r\n";
$headers .= "Reply-To: {$from}\r\n";
$headers .= "X-Mailer: PHP/" . phpversion();
mail($to, $subject, $message, $headers);
}
...
Anyone know what's up? Apparently I am doing something wrong.
Oh yeah.. Even if there is nothing in the textarea, the code doesn't echo "Error: no message"; as it should.
Anyone?