BMI Test

18.5 to 24.9.
To be within the right range for your height, you should weigh between %%LOWERLIMIT%% lbs / %%LOWERLIMITKG%% kg and %%UPPERLIMIT%% lbs / %%UPPERLIMITKG%% kg“;
$uppertext=”Your current BMI is greater than the recommended range of 18.5 to 24.9.
To be within the right range for your height, you should weigh between %%LOWERLIMIT%% lbs / %%LOWERLIMITKG%% kg and %%UPPERLIMIT%% lbs / %%UPPERLIMITKG%% kg“;
?>

$var)
{
$_SESSION[‘bmi_calc_’.$key]=$var;
}
if($_POST[‘system’]==’english’)
{
$height=$_POST[‘height_ft_en’]*12+$_POST[‘height_in_en’];
$bmi=($_POST[‘weight_en’]*703) / ($height*$height);
}
else
{
$height=$_POST[‘height_met’]/100;
$bmi=$_POST[‘weight_met’] / round(($height*$height),2);
}

$bmi=number_format($bmi,1,”.”,””);

// prepare message for the user
if($bmi<=18.5) { $bmimsg="Underweight"; } if($bmi>18.5 and $bmi<=24.9) { $bmimsg="Normal"; } if($bmi>=25 and $bmi<=29.9) { $bmimsg="Overweight"; } if($bmi>=30)
{
$bmimsg=”Obese”;
}

// what is the weight range?
if($bmimsg!=’Normal’)
{
if($_POST[‘system’]==’english’)
{
$lowerlimit=number_format(( 18.5 * ($height*$height) ) / 703);
$lowerlimitkg=number_format($lowerlimit*0.453,1,”.”,””);

$upperlimit=number_format(( 24.9 * ($height*$height) ) / 703);
$upperlimitkg=number_format($upperlimit*0.453,1,”.”,””);
}
else
{
$lowerlimit=number_format( 18.5 * ($height*$height) * 2.204 );
$lowerlimitkg=number_format(18.5 * ($height*$height),1,”.”,””);

$upperlimit=number_format( 24.9 * ($height*$height) * 2.204 );
$upperlimitkg=number_format(24.9 * ($height*$height),1,”.”,””);
}
}

//prepare texts
$firsttext=str_replace(“%%BMI%%”,$bmi,$firsttext);
$firsttext=str_replace(“%%BMIMSG%%”,$bmimsg,$firsttext);
$lowertext=str_replace(“%%LOWERLIMIT%%”,$lowerlimit,$lowertext);
$lowertext=str_replace(“%%LOWERLIMITKG%%”,$lowerlimitkg,$lowertext);
$lowertext=str_replace(“%%UPPERLIMIT%%”,$upperlimit,$lowertext);
$lowertext=str_replace(“%%UPPERLIMITKG%%”,$upperlimitkg,$lowertext);
$uppertext=str_replace(“%%LOWERLIMIT%%”,$lowerlimit,$uppertext);
$uppertext=str_replace(“%%LOWERLIMITKG%%”,$lowerlimitkg,$uppertext);
$uppertext=str_replace(“%%UPPERLIMIT%%”,$upperlimit,$uppertext);
$uppertext=str_replace(“%%UPPERLIMITKG%%”,$upperlimitkg,$uppertext);
}
?>

onclick=”changeSystem(‘english’);”> English
 
onclick=”changeSystem(‘metric’);”> Metric

“> lbs
;”>“> kg

“> ft
  “> in

“> cm