English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I want it to check for blank text spots and if there is any, to echo with the "wrong image". If none are blank, for it send me an email. But it won't work correctly, it will always give me an email, when some textfileds are blank.

2007-06-11 15:57:11 · 3 answers · asked by truepal20032001 2 in Computers & Internet Programming & Design

// Prepare the variables for handling.
$name = ($_POST[name]);
$email = ($_POST[email]);
$phone = ($_POST[phone]);
$comment = ($_POST[comment]);
// Prepare the message feedback.
$msg = "Name: $name\n";
$msg.= "Email: $email\n";
$msg.= "Phone: $phone\n";
$msg.= "Message sent: ".date('m/d/y')."

$msg.= "Comment/Message:\n";
$msg.= "

$comment\n";

If ($name == NULL ||
$email == NULL ||
$comment == NULL)
{
$required=FALSE;
}
else{
$required = TRUE; }

If ($required === TRUE){
@mail('mail@yahoo.com','Comment/Message',$msg,'FROM:'.$_POST[email]);
echo "Thankyou!


You'll be replied soon.







";
echo '

';
}
else{
echo "ERROR!!


An error has just occured, these might have been the cause:

1. Did not fill in all of the neccessary blanks.


?>

2007-06-11 15:57:53 · update #1

ignore the "..." continuation of mail function, its complete, thats not the problem

2007-06-11 16:00:40 · update #2

3 answers

Try :
If (!($name > "") or
!($email > "") or

etc.

2007-06-11 16:10:03 · answer #1 · answered by Anonymous · 0 0

Don't check to see if the variables are NULL. Instead use strlen();

if( strlen($variable) <= 0)
{
$required = false;
}

2007-06-11 23:03:45 · answer #2 · answered by Nicholas 4 · 0 0

change those NULL's to "" s

2007-06-11 23:10:55 · answer #3 · answered by iammisc 5 · 0 0

fedest.com, questions and answers