Ver Mensaje Individual
  #6 (permalink)  
Antiguo 06/06/2003, 01:46
Avatar de Helbira
Helbira
 
Fecha de Ingreso: octubre-2001
Ubicación: Sevilla, España
Mensajes: 1.228
Antigüedad: 25 años
Puntos: 5
Información ... intuyendo lo que quieres

Código PHP:
<% 
nCorrect = 0
i 
= request.form(RS("Question"))

if 
i = "" then

response
.write "No contesto a la pregunta"
else 

response.write("<p class='Ques'>" & RS("Question") & "</p>")
response.write("<p class='Ans'>La respuesta correcta:" & RS("Valor") & "")

if (
i= RS("Valor")) Then

response
.write(" <p class='CorExpl'>¡CORRECTO! Tu respuesta ha sido: " & i & "</p><br><br>")
nCorrect = nCorrect + 1

else

response.write(" <p class='IncExpl'>¡INCORRECTO! Tu respuesta ha sido: " & i & "</p><br><br>")

end if
nPercent = nCorrect / 10 * 100
%>
VALORACIÓN:<%= nCorrect %> DE 10 PREGUNTAS.
(<%= 
nPercent %> )
<%
end if 
RS.MoveNext
Loop

RS
.Close
Set RS 
= Nothing
oConn
.Close
Set oConn 
= Nothing

%> 
Supongo que si tu test tiene 10 preguntas ese codigo estará dentro de un bucle... Entonces la primera sentencia nCorrect = 0 la tienes que que poner fuera del bucle.

Si te da algún error ponlo aquí... programar a ciegas es difícil acertar a la primera.

Un beso

Última edición por Helbira; 06/06/2003 a las 02:37