0
$type = trim(strip_tags(stripslashes($_GET['type'])));
$referer = $_SERVER["HTTP_REFERER"];     

if ($type == "Clinical" && $referer == "al.php?zh=loadPage") {
    echo "clinical";
}
elseif ($type == "AnnualEducation" && referer == "ual.php?zh=loadPage") {
    echo "annual";
}
else {
    echo "neither";
}

The issue I am having is if the type is Clinical and al.php?zh=loadpage then the IF fires (which is correct) but when the type is AnnualEducation and ual.php?zh=loadpage the ELSE fires. Somehow the elseif is being skipped.

Any idea to resolve it?

4

1 回答 1

6

在你的elseif

elseif ($type == "AnnualEducation" && referer == "ual.php?zh=loadPage") {

应该

elseif ($type == "AnnualEducation" && $referer == "ual.php?zh=loadPage") {

你错过了$一个$referer

于 2013-06-12T15:31:40.923 回答