Count time upto click submit in the same page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ahmurad
    New Member
    • Aug 2007
    • 19

    Count time upto click submit in the same page

    Dear Brothers / Xperts,

    I need to count time of a page upto click submit. When the user just enter the page the timer / start time is tracked . When the user submit the form then the end time is need to be measured.

    The calculated time ($end - $start) is need to keep in a php variable and after then the form will be submitted.

    I am trying to do this work using the below php technique...[php]$start = microtime(true) ;
    .
    . // My code goes here.
    .
    $end = microtime(true) ;
    echo 'Total script execution time: ', ($end - $start), '.';[/php]How can I process the end time (when user click the submit button)?
    Last edited by ronverdonk; May 4 '08, 09:40 AM. Reason: code tags!
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    Use $_SERVER['REQUEST_TIME'] or gettimeofday() to find the current time in both cases.
    Use session to store $start.

    Anything else?

    PS: But that shouldn't be called "Total script execution time" as you have written.
    Script execution time is the time taken by a script to get executed.

    Comment

    Working...