countdown timer question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nomad
    Recognized Expert Contributor
    • Mar 2007
    • 664

    countdown timer question

    Hello everyone again:
    Ok I figured out the quiz section and now I need to but a timer on the test.
    if anyone knows how to do a countdown timer that will only lasts for 30mins(or what ever time) for a test? Like when I click a 'start test' button, the timer will operate by itself and when it hits 30mins, the test session will end by itself and the students will just have to press on a submit button for their scores.

    thanks
    nomad
  • satas
    New Member
    • Nov 2007
    • 82

    #2
    Originally posted by nomad
    Hello everyone again:
    Ok I figured out the quiz section and now I need to but a timer on the test.
    if anyone knows how to do a countdown timer that will only lasts for 30mins(or what ever time) for a test? Like when I click a 'start test' button, the timer will operate by itself and when it hits 30mins, the test session will end by itself and the students will just have to press on a submit button for their scores.

    thanks
    nomad
    It is possible to have a table in the database. When the student begin the quiz new row appears. In that row you should store time when the quiz was started and quiz ID. During the test script will has to compare current time with time in the row using ID.

    Good luck!

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      Originally posted by satas
      It is possible to have a table in the database. When the student begin the quiz new row appears. In that row you should store time when the quiz was started and quiz ID. During the test script will has to compare current time with time in the row using ID.

      Good luck!
      That is not a countdown timer: it does not count down, but just compare 2 time values only when the user does something that triggers the SERVER code to be executed.

      When the user just stays within his client environment, it never runs. So for an exam, the sutdent could stay within his form for 24 hours doing nothing and looking up the answers before filling in and submiiting and triggering server code to be run.

      No, you have to use client code like JavaScript to run this. Luckily there are numerous count down timers to be found on the web. Just google for it. One simple one can be found countdown timer

      Ronald

      Comment

      • satas
        New Member
        • Nov 2007
        • 82

        #4
        Originally posted by ronverdonk
        That is not a countdown timer: it does not count down, but just compare 2 time values only when the user does something that triggers the SERVER code to be executed.

        When the user just stays within his client environment, it never runs. So for an exam, the sutdent could stay within his form for 24 hours doing nothing and looking up the answers before filling in and submiiting and triggering server code to be run.
        But it is php forum. I've just wrote method how to orginize server-side logic for this.
        Thread starter should decide how to implement it in users browser.
        I think the best way is to use AJAX and perform query to the server every 10 seconds.

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          You cannot escape using JavaScript for this. This may be the PHP forum but even a server side language cannot perform client side operations. Ajax is only a way of using server side code with client side code via the HTTP path.

          A real-time countdown timer can only be written in client side code. And a timer like this is straight forward and costs no more than approx. 10 statements. Using extra PHP for this is just make up.

          Ronald

          Comment

          • satas
            New Member
            • Nov 2007
            • 82

            #6
            Yeah, nothing to add. You're absolutely right.

            Comment

            • nomad
              Recognized Expert Contributor
              • Mar 2007
              • 664

              #7
              Originally posted by ronverdonk
              That is not a countdown timer: it does not count down, but just compare 2 time values only when the user does something that triggers the SERVER code to be executed.

              When the user just stays within his client environment, it never runs. So for an exam, the sutdent could stay within his form for 24 hours doing nothing and looking up the answers before filling in and submiiting and triggering server code to be run.

              No, you have to use client code like JavaScript to run this. Luckily there are numerous count down timers to be found on the web. Just google for it. One simple one can be found countdown timer

              Ronald
              Thanks Ronald...
              Didn't even think of using javascript

              damon

              Comment

              • ronverdonk
                Recognized Expert Specialist
                • Jul 2006
                • 4259

                #8
                Originally posted by nomad
                Thanks Ronald...
                Didn't even think of using javascript

                damon
                Yeah, despite being in the PHP forum, we sometimes have to use a 'lesser' (sorry JS adapts) language because it suits us.

                Ronald

                Comment

                • nomad
                  Recognized Expert Contributor
                  • Mar 2007
                  • 664

                  #9
                  Originally posted by ronverdonk
                  Yeah, despite being in the PHP forum, we sometimes have to use a 'lesser' (sorry JS adapts) language because it suits us.

                  Ronald

                  You're still up when do you sleep?
                  Dedicated person here.
                  nomad

                  Comment

                  • ronverdonk
                    Recognized Expert Specialist
                    • Jul 2006
                    • 4259

                    #10
                    Originally posted by nomad
                    You're still up when do you sleep?
                    Dedicated person here.
                    nomad
                    I usually sleep from about 2am to 10am, which is about 9 hours from now (Dutch standard time).

                    Ronald

                    Comment

                    Working...