最近我的网络服务器从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;?>
答案 0 :(得分:5)
看起来你期待register_globals
开启。现在默认情况下已关闭。
您应该使用$_GET['heightft']
或$_POST['heightft']
,具体取决于表单方法来访问此数据。