update
This commit is contained in:
36
bmi_631_1.php
Normal file
36
bmi_631_1.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$height = $_POST['height'];
|
||||
$weight = $_POST['weight'];
|
||||
if ($height!= "" && $weight!= "") {
|
||||
$bmi = $weight / ($height * $height);
|
||||
if ($bmi >= 18.50 && $bmi <= 23.90) {
|
||||
$result = "BMI指数正常";
|
||||
} else {
|
||||
$result = "BMI指数异常";
|
||||
}
|
||||
} else {
|
||||
$result = "请输入完整的身高和体重信息";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>BMI健康指标计算器</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
|
||||
身高(米): <input type="text" id="height" name="height" placeholder="请输入身高"><br>
|
||||
体重(千克): <input type="text" id="weight" name="weight" placeholder="请输入体重"><br>
|
||||
<input type="submit" id="ok" name="ok" value="确定">
|
||||
</form>
|
||||
<?php if (isset($result)) {?>
|
||||
<p><?php echo $result;?></p>
|
||||
<?php }?>
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user