最近我的webserver從PHP v.4遷移到v.5.3。我知道,我知道,很長一段時間:)由於v.4到v5遷移,PHP腳本不再起作用
但是現在當用戶輸入所需的數據時,我的一些腳本不顯示結果。這裏是腳本:
<?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;?>
'$ ok'在哪裏設置? – hek2mgl 2013-04-21 20:27:00
不要緊,升級PHP晚了,你*仍然*使用''? – 2013-04-21 20:32:16