if ($fname <> "" and $lname <> "" and $theemail <> "" and $empid <> "" and $doh <> "" and $ydept <> "#") {
if ($percentage >= 85) {
mail ($myEmail, $mailSubject, $msgBody, $header);
mail ($userEmail, $sentMailSubject, $sentMailBody, $sentHeader);
$filename = "output_annualexam.txt"; #Must CHMOD to 666, set folder to 777
$text = "\n" . str_pad($fname, 25) . "" . str_pad($lname, 25) . "" . str_pad($empID, 15) . "" . str_pad($doh, 15) . "" . str_pad($tdate, 20) . "" . str_pad($ydept, 44) . "" . str_pad($percentage, 0) . "%";
$fp = fopen ($filename, "a"); # a = append to the file. w = write to the file (create new if doesn't exist)
if ($fp) {
fwrite ($fp, $text);
fclose ($fp);
#echo ("File written");
}
else {
#echo ("File was not written");
}
header ("Location: congrats.php?fname=$fname&type=$type");
}
else {
header ("Location: nopass.php?percent=$percentage&type=$type");
}
}
else {
header ("Location: tryagain.php?type=$type");
}
When $ydept=="#" it means the user did not select any department from the SELECT options which will make the IF statement fail, which should automatically take the user to the tryagain.php page but instead it's taking them to the nopass.php page. So somewhere it's failing.
Should I try && instead of AND? But I don't think it should make a difference.