Limiting number of tries in a quiz (ASP not

Discussion in 'ASP General' started by bj, Apr 16, 2004.

  1. bj

    bj Guest

    I want to limit the number of tries an individual has at a question in
    an online asp quiz to two. I cannot write to the user's hard drive.
    I understand that this is possible to do using session cookies (not
    that desireable since the powers that be get very nervous with even
    the mention of a cookie), session variables or by using the url and
    the get/post method of a form. Can someone tell me either (1) how to
    do it or, (2) wher to look to see how.

    bj, Apr 16, 2004
    1. Advertisements

  2. bj

    Scott McNair Guest

    (bj) wrote in
    If Request.Form("Attempt")="" Then Attempt = 0 Else Attempt = CInt
    Answer = Request.Form("Answer")
    If Answer = "23" Then Response.Write "Correct!" : Response.End
    Attempt = Attempt + 1
    If Attempt > 2 Then Response.Write "Sorry! You missed two times." :
    If Attempt <> 1 Then Response.Write "Sorry, that's the wrong answer.
    Try again:<br><br>"
    <form method=post action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
    <input type=hidden name=Attempt value="<%=Attempt%>">
    I'm thinking of a number:
    <select name=Answer>
    <option value="5">5</option>
    <option value="23">23</option>
    <option value="55">55</option>
    <option value="235">235</option>
    <input type=submit>
    Scott McNair, Apr 16, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.