PDA

View Full Version : Form help



smrpgx
02-14-2006, 01:13 AM
here is what I have...



<?php
function checkOK($field)
{
if (eregi("\r",$field) || eregi("\n",$field)){
die("Invalid Input!");
};

$type = $_POST['type'];
checkOK($type);
$comments = $_POST['comments'];
checkOK($comments);
$email = $_POST['email'];
checkOK($email);
$to="smrpgx@gmail.com";
$message="A visitor with the IP address $REMOTE_ADDR has sent an email from Rave Games. He/She said:\n$comments\n\nHis/Her email address is $email";
if(mail($to,"Visitor feedback: $type",$message,"From: $email\n")) {
echo "Thanks for your comments.";
} else {
echo "There was a problem sending the mail. Please check that you filled in the form correctly.";
}
?>


Can anyone tell me what I am doing wrong?

Twey
02-14-2006, 09:42 AM
Apart from the fact that it's $_SERVER['HTTP_REMOTE_ADDR'] not $REMOTE_ADDR, not too much, at a quick glance. Fancy giving us a hint? The error(s) you get, maybe?