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");
}
当 $ydept=="#" 表示用户没有从 SELECT 选项中选择任何部门,这将导致 IF 语句失败,这应该自动将用户带到 tryagain.php 页面,而是将他们带到 nopass。 php页面。所以在某个地方它失败了。
我应该尝试&&而不是AND吗?但我不认为它应该有所作为。