|
<%
If Weight = "" then
Error = "Please enter a correct weight. "
End If
If not IsNumeric(Weight) then
Error = "Please enter a correct weight. "
End If
If Instr(Weight, "E") or Instr(Weight, "e") or Instr(Weight, "D") or Instr(Weight, "d") then
Error = "Please enter a correct weight. "
End If
If Weight = "" Or Error > "" then
%>
Body Mass Index (BMI) is an index of a person's weight in relation to height, not body composition.
<%Else%>
Thank you for using BMI calculator.
<%End If%>
BMI values apply to both men and women, regardless of their age, frame size, or muscle mass. These values do not apply to athletes and body builders, pregnant and nursing women, frail or elderly persons or persons under 18. Use this information, along with other health indices, to assess your need to change your weight. A BMI of 25 or more indicates overweight, obesity is equal to or greater than BMI 30.
People who are overweight or obese have a greater chance of developing high blood pressure, high blood cholesterol, type 2 diabetes, heart disease, stroke and certain cancers.
This test should be used as a guideline and is based on information found in The Section of Diabetes and Clinical Nutrition, University of Southern California School of Medicine, Los Angeles.
|
|
|
<%
Dim strWeight, WeightType, Message, Alone, Error, BMI, strHeight, strHeightMeters, Kilograms, NewHeight, strFeet, strInches
Error = ""
If Request.ServerVariables("REQUEST_METHOD") = "POST" then
Feet = Request("Feet")
strWeight = Request("Weight")
WeightType = Request("WeightType")
strHeight = Request("Height")
strHeightInches = Request("Height")
strHeightMeters = Request("HeightMeters")
If strHeight="feet" and strHeightMeters="meters" then
Error = "Please select your height in meters or feet. "
strHeight="feet"
strHeightMeters="meters"
End If
If not strHeight="feet" and not strHeightMeters="meters" then
Error = "Please only select your height in either meters or feet. "
strHeight="feet"
strHeightMeters="meters"
End If
if strWeight <> "" then
if WeightType="Pounds" then
strNewWeight=strWeight*703
elseif WeightType="Kilograms" then
strNewWeight=strWeight * 2.24 * 703
end if
end if
If strHeight="feet" and not strHeightMeters="meters" then
NewHeight = (strHeightMeters*39.37)^2
End If
If strHeightMeters="meters" and not strHeight="feet" then
NewHeight = strHeight^2
End If
If strWeight = "" then
Error = "Please enter a correct weight. "
End If
If not IsNumeric(strWeight) then
Error = "Please enter a correct weight. "
End If
If Instr(strWeight, "E") or Instr(strWeight, "e") or Instr(strWeight, "D") or Instr(strWeight, "d") then
Error = "Please enter a correct weight. "
End If
If WeightType = "" then
Error = "Please select either pounds or kilograms. "
End If
If Error = "" then
BMI = strNewWeight/NewHeight
If Instr(BMI, ".") then
BMI = Mid(BMI, 1, (Instr(BMI, ".") + 1))
End If
If BMI < 18.5 then
Message = "A BMI score of less than 18.5 indicates you are underweight. You may wish to consult with your healthcare professional or nutritionist to discuss whether any health risks are associated with being underweight."
ElseIf BMI >= 18.5 and BMI <= 24.9 then
Message = "A BMI score of 18.5 to 24.9 indicates you have a healthy body fat ratio. Remember to keep your healthy lifestyle by eating right and exercising."
ElseIf BMI >= 25 and BMI <= 29.9 then
Message = "A BMI score of 25.0 to 29.9 indicates you are overweight. You could be at increased risk for Type 2 Diabetes, Hypertension and Heart Disease. Learn how to set realistic goals to reduce your risk of disease."
ElseIf BMI >= 30 then
Message = "A BMI score of over 30.0 indicates moderate to severe obesity. Although weight loss can be difficult, even a modest weight loss of 10 to 20 pounds can bring significant health improvements, such as lowering ones' blood pressure and cholesterol levels. Learn more on sensible Weight Loss and the diseases that you can prevent by losing weight."
End If
End If
End If
%>
<%
If BMI = "" Or Error > "" then%>
<%If Error > "" then
%>
<% = Error%>
<%End If%>
<%Else%>
|
<%If strHeight="feet" then %>
<% = strHeightMeters%> m.,
<%End If %>
<% If strHeightMeters="meters" then
strFeet=Round((strFeet),2)
strFeet=Split((Round((strHeightInches/12),2)),".")
If Ubound(strFeet,1)=0 then
strInches=0
else
strtest = strFeet(1)/5
if strtest = 1 then
strFeet(1) = strFeet(1) * 10
end if
strInches=Round((12*(strFeet(1)/100)),0)
End If
strInches = Round(strInches,0)
%>
<%=strFeet(0) %>'<% = strInches%>",
<%End If %>
<%If WeightType="Pounds" then %>
<%=strWeight %> lbs.
<%End If %>
<%If WeightType="Kilograms" then %>
<%=strWeight %> kgs.
<%End If %> |
| Your BMI score is: <% = BMI%> |
<% = Message%> |
<%End If%>
|
|