problem with array and calculate ASP T_T

Recommended Posts

edited

Share on other sites

You can simplify something like this:

`	students(1) = "StudentID_1"	students(2) = "StudentID_2"	students(3) = "StudentID_3"	students(4) = "StudentID_4"	students(5) = "StudentID_5"	students(6) = "StudentID_6"	students(7) = "StudentID_7"	students(8) = "StudentID_8"	students(9) = "StudentID_9"	students(10) = "StudentID_10"	students(11) = "StudentID_11"	students(12) = "StudentID_12"	students(13) = "StudentID_13"	students(14) = "StudentID_14"	students(15) = "StudentID_15"	students(16) = "StudentID_16"	students(17) = "StudentID_17"	students(18) = "StudentID_18"	students(19) = "StudentID_19"	students(20) = "StudentID_20"		for i = 1 to 20	students(i) = request.form(students(i))	next`

to this:

`for i = 1 to 20  students(i) = request.form("StudentID_"&i)next`

You have some problems with your calculations though. You have this at the top:AssessmentSum = (Cint(Assessment1_1)+Cint(Assessment2_1)+Cint(Assessment3_1))Average = (Cint(Assessment1)/No_Students)The reason that is 0 is because by the time you run that code none of those variables have values. Instead you get the values after you define the sum and average. You can't define the sum and average without getting the values to sum and average first. Also, with this area:Assessment(1) = (Cint(Assessment1_1)+Cint(Assessment2_1)+Cint(Assessment3_1))Assessment(2) = (Cint(Assessment1_2)+Cint(Assessment2_2)+Cint(Assessment3_2))Assessment(3) = (Cint(Assessment1_3)+Cint(Assessment2_3)+Cint(Assessment3_3))There aren't variables defined called Assessment1_2, Assessment2_3, etc. There are Assessment1(2) and Assessment2(3) though.

edited

Share on other sites

oh, i can simplify it its need (i).... thx....btw is my thinking about the array request form true?

Share on other sites

I don't know what you're referring to, you've edited the text out of your other posts.

Share on other sites

i've complete all....=D dat's y i edit....nyway ur code to simplify really help me....thx =)