-1

最近我的网络服务器从 PHP v.4 迁移到 v.5.3。我知道,我知道,好久不见:)

但是现在当用户输入所需的数据时,我的一些脚本不会显示结果。这是脚本:

<?php 
if ($ok) {

    if ($heightft == "" || $heightin == "" || $weight == "") {
        $error = "<br><FONT COLOR=#FF0000>One of the fields above was not completed.</FONT><br>";
    } else {
        $bmi = $weight * 703 / (($heightft * 12 + $heightin) * ($heightft * 12 + $heightin));
        $bmiString = number_format($bmi,2,".","");
        echo "<table border='1' cellpadding='10' bordercolor='0000FF'><tr><td><strong>Your BMI is: " . $bmiString;
echo "<br><br></strong>";

        if ($bmi <= 18.50) { 
            echo "You are classified as <strong>Underweight</strong>."; 
        } elseif ($bmi <= 24.99) {
            echo "You are classified as <strong>Normal</strong>."; 
        } elseif ($bmi <= 29.99) {
            echo "You are classified as <strong>Overweight</strong>."; 
        } else { 
            echo "You are classified as <strong>Obese</strong>.</td></tr></table></bordercolor>"; 
        }       
    }
}

?>

<?php echo $error;?>
4

1 回答 1

5

看起来你期待着上场register_globals。现在默认关闭。

您应该使用$_GET['heightft']$_POST['heightft']依赖于表单方法来访问此数据。

于 2013-04-21T20:30:39.860 回答