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
Last edited by emarshah; Jun 27th, 2009 at 5:33 am.
Reputation Points: 10
Solved Threads: 6
Junior Poster in Training
Offline 61 posts
since Jan 2008