Math and ASP, My Struggle

# Thread: Math and ASP, My Struggle

1. Member
Join Date
Dec 1969
Posts
47

## Math and ASP, My Struggle

Here is my script:<BR> &#060;%<BR>If Request.Form("DOIT")&#060;&#062;"" Then<BR>Dim feet, inches, weight, totalheight, totalheight2, bmi, ideal, loose, bmi2<BR>feet=cInt(Request.Form("feet"))<BR>inches= cInt(Request.Form("inches"))<BR>weight=cInt(Reques t.Form("weight"))<BR>totalheight=feet+inches<BR>to talheight=totalheight*totalheight<BR>totalheight=w eight/totalheight<BR>totalheight=totalheight*704.5<BR>to talheight2=feet+inches<BR>totalheight2=totalheight 2*totalheight2<BR>bmi=totalheight<BR>bmi=Round(bmi ,2)<BR>bmi2=bmi<BR>ideal=21/704.5<BR>ideal=ideal*totalheight2<BR>ideal=Round(i deal)<BR>loose=Round(weight-ideal)<BR><BR>Dim classification<BR>If bmi2&#060; 18.9 Then<BR>classification="Under Weight"<BR>ElseIf bmi2 &#062; 19 Or bmi2 &#060; 24.9 Then<BR>classification="Normal Weight"<BR>ElseIf bmi2 &#062; 25 Or bmi2 &#060; 29.9 Then<BR>classification="Overweight"<BR>ElseIf bmi2 &#062; 30 Or bmi2 &#060; 34.9 Then<BR>classification="Obese"<BR>Else classification=""<BR>End If<BR>Dim classification2<BR>If bmi2&#060; 24.9 Then<BR>classification2="Minimal/Low - You are within a healthy weight range."<BR>End If<BR>If bmi2 &#062; 25 Or bmi2 &#060; 29.9 Then<BR>classification2="Low/Moderate - You may be at a slightly increased risk for cardiovascular and other diseases."<BR>End If<BR>If bmi2 &#062; 30 Or bmi2 &#060; 34.9 Then<BR>classification2="Moderate/High - You may be at an increased risk for cardiovascular, hypertension and high blood cholesterol."<BR>End IF<BR>If bmi2 &#062; 35 Then<BR>classification2="High - You may be at an significantly increased risk of obesity-related disease."<BR>End If<BR>End If<BR><BR>%&#062;<BR><BR>For some reason I cannot get it to pull &#039;classification&#039; or &#039;classification&#039; propoerly from the bmi2 total. It just hangs and always pulls the "Normal Weight" and the "MOderate/High" <BR><BR>Any suggestions would be great.

2. Senior Member
Join Date
Dec 1969
Posts
1,274

## RE: Math and ASP, My Struggle

My guess is you want to replace the "OR"s with "AND"s. Look at your first IF...ELSEIF...END IF statement. <BR><BR>ElseIf bmi2 &#062; 19 Or bmi2 &#060; 24.9 Then<BR>classification="Normal Weight"<BR><BR>As long as bmi2 is greater than 19, the ELSEIF will evaluate to true, and you&#039;ll get the classification of "Normal Weight"

3. Member
Join Date
Dec 1969
Posts
47

## RE: Math and ASP, My Struggle

Thanks, That worked out, I guess my logic was not very logical! Ha, ha

4. Senior Member
Join Date
Dec 1969
Posts
96,118

## MAJOR BUG!!!

If bmi2&#060; 24.9 Then<BR> classification2="Minimal/Low - You are within a healthy weight range."<BR>End If<BR>If bmi2 &#062; 25 AND bmi2 &#060; 29.9 Then<BR> classification2="Low/Moderate - You may be at a slightly increased risk for cardiovascular and other diseases."<BR>End If<BR><BR>********<BR><BR>So what happens to somebocy with a bmi2 that is exactly 25?<BR><BR>Or, for that matter, 24.917 or 24.999 ????<BR><BR>You need to change all of those!<BR><BR>If bmi2 [hl="yellow"]&#060; 25.0[/hl] Then<BR> classification2="Minimal/Low - You are within a healthy weight range."<BR>End If<BR>If bmi2 [hl="yellow"]&#062;= 25.0[/hl] AND bmi2 [hl="yellow"]&#060; 30.0[/hl] Then<BR> classification2="Low/Moderate - You may be at a slightly increased risk for cardiovascular and other diseases."<BR>End If<BR><BR>Etc.<BR><BR>And how come you used ELSEIF in the first set of tests but abandoned it in the second set???<BR><BR>If bmi2 [hl="yellow"]&#060; 25.0[/hl] Then<BR> classification2="Minimal/Low - You are within a healthy weight range."<BR>Elseif bmi2 [hl="yellow"]&#062;= 25.0[/hl] AND bmi2 [hl="yellow"]&#060; 30.0[/hl] Then<BR> classification2="Low/Moderate - You may be at a slightly increased risk for cardiovascular and other diseases."<BR>Elseif ....<BR><BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•