Forum Moderators: open
If cint(request("q"))<=10 AND cint(request("q"))>=0 Then
response.redirect "example2.asp?e=e"
LINE 3 * ElseIf cint(request("q"))<=29 AND cint(request("q")) >=11 Then *END LINE 3
response.redirect "example2.asp?e=x"
ElseIf cint(request("q"))<=49 AND cint(request("q"))>=30 Then
response.redirect "example2.asp?e=a"
ElseIf cint(request("q"))=50 Then
response.redirect "example2.asp?e=m"
ElseIf cint(request("q"))<=74 AND cint(request("q"))>=51 Then
response.redirect "example2.asp?e=p"
ElseIf cint(request("q"))<=99 AND cint(request("q"))>=75 Then
response.redirect "example2.asp?e=l"
ElseIf cint(request("q"))=100 Then
response.redirect "example2.asp?e=e"
Else
response.redirect "example3.asp"
end if
And the error it brings up is:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'cint'
/exampl/eexamp/leexam/results.asp, line 3
** PLEASE HELP **
I would suggest first performing a IsNumeric() call on the value you're dealing with.
if IsNumeric(your_value) then
'do something; everything's fine
else
'show error; value is not numeric
end if
2, 12, 11, 15
You see q is made up of a series of questions in a form. I thought it would add the values up.
<input thing name="q">
<input thing name="q">
If I change the values to
<input thing name="q">
<input thing name="q2">
could someone tell how to add values up:
q+q2 eg. to make a new value ie newq?
for each myvalue in request("q14")
if isNumeric(myvalue) then
intQuestionSum = intQuestionSum + myvalue
end if
next
If cint(request("intQuestionSum"))<=10 AND cint(request("intQuestionSum"))>=0 Then
response.redirect "example.asp?im=e"
ElseIf cint(request("intQuestionSum"))<=29 AND cint(request("intQuestionSum"))>=11 Then
response.redirect "example.asp?im=x"
My problem is no matter what value q is and I have checked by getting it to response.write it always redirects you to example.asp?im=x
If intQuestionSum <=10 AND intQuestionSum >=0 Then
response.redirect "example.asp?im=e"
ElseIf intQuestionSum <=29 AND intQuestionSum >=11 Then
response.redirect "example.asp?im=x"
End If
Try that.