Create an HTML page with a PHP script that calculates and displays BAI (Body Adi
ID: 3814769 • Letter: C
Question
Create an HTML page with a PHP script that calculates and displays BAI (Body Adiposity Index). The BAI is an alternative to BMI that approximates the percentage of body fat. Write the PHP script in a function, and call the function from the body of the HTML document. The formula to calculate BAI is: BAI=(100xhip circumference in meters) /(height in meters x SQR(height in meters)) -18 For now, create variables for hip circumference and height (in meters,) - and hard-code a value in for them Print out the hip circumference, height, and BAI.
Explanation / Answer
<html>
<head>
<title>Online PHP Script Execution</title>
</head>
<body>
<?php
$hip_circumference=0.5;
$height=1.7;
function calBAI() {
$BAI=((100 * $GLOBALS['hip_circumference']) /($GLOBALS['height'] * $GLOBALS['height'])) -18;
return $BAI;
}
echo "<h1>Hip circumference :" . $hip_circumference . "</h1><br>";
echo "<h1>Height :" . $height . "</h1><br>";
echo "<h1>BAI :" . calBAI() . "</h1><br>";
?>
</body>
</html>
Note: Please ask any doubts you have. Happy to help. God bless you!!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.