Hi,
It sends the mail because you didn't write the else code, you should send the mail in the else block of all the above if's ....
try the following;
if($from == '') {echo "<script langauge=\"javascript\">alert('Mail not Sent, You have not entered a Name, please go back fill up and try again!!')</script>";}
else {
if($phone == '') {echo "<script langauge=\"javascript\">alert('Mail not Sent,You have not entered a Phone Ext, please go back fill up and try again!!')</script>";}
else {
if($subject== '') {echo "<script langauge=\"javascript\">alert('Mail not Sent,You have not entered a Subject, please go back and try again!!')</script>";}
else
{
$ok = @mail($to, $subject, $message, $headers);
// because the system will send mail even after showing the alert
// messages to the user. you should write the mail code inside the // innermost else block.
}
}
}
Hope this will help you, if it did, add it to my reputation. Thanks
emarshah
Junior Poster in Training
61 posts since Jan 2008
Reputation Points: 10
Solved Threads: 6