入力フィールドから変数を取得するこのphpスクリプトが1ページにあります。
if($fname <> "" and $lname <> "" and $ydept <> "") {
if ($percentage >= "85") {
mail ($myEmail, $mailSubject, $msgBody, $header);
mail ($userEmail, $sentMailSubject, $sentMailBody, $sentHeader);
$filename = "blah.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) . "";
$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: yes.php?fname=$fname&type=$type");
}
else {
header ("Location: didnotpass.php?percent=$percentage&type=$type");
}
}
else {
header ("Location: empty.php?type=$type");
}
そして、didnotpass.phpスクリプトは次のとおりです。
<?php
if (isset($_GET['type']) && isset($_GET['percentage'])) {
$percent = trim(strip_tags(stripslashes($_GET['percent'])));
$type = trim(strip_tags(stripslashes($_GET['type'])));
if ($type == "Clinical") {
?>
The Certificate of Attendance has been completed yet, but your score of $percent% is less then the passing score of 85%.<br><br>
Please <b><a href="C.php">Click Here</a></b> to retake the certification.
<?php
}
else {
?>
The Certificate of Attendance has been completed yet, but your score of $percent% is less then the passing score of 85%.<br><br>
Please <b><a href="nonC.php">Click Here</a></b> to retake the certification.
<?php
}
}
else {
?>
Please <b><a href="start.php">Go To Certification Homepage</a></b> to start the certification.
<?php
}
?>
私が抱えている問題は、スコアが85%であるかどうかであり、最後のelseステートメントに進みます。
Please <b><a href="start.php">Go To Certification Homepage</a></b> to start the certification.
私のIFステートメントは正しいですか:
if ($percentage >= "85")
正しいページにルーティングされているため、正しく機能していると思いますが、didnotpass.phpのIF/ELSEステートメントが正しく機能していません。誰かが私がそれを修正するのを手伝ってくれる?