I have an HTML table in which records from a database are written. Entries from the Call Time column are retrieved from the MySQL database. The entries in the Timer column are not retrieved from the database; this is a Javascript timer.

As soon as the user presses the confirmation button, the timer stops , and the final timer value must be COMPLETED in the database. The next Javascript timer is a slightly modified version of another user's code ( Elapsed time from a specific time in the database )
Problem: I do not know how to insert the Elapsed Time value in the hidden form fields. Please note that for each record there is one hidden form field with id="stoppedtime<?php echo $stopid; ?> , I know that I need to continue to increase the value of the stop variable. I need to insert every elapsed time (after clicking confirmation buttons) in the corresponding fields of the hidden form, so that subsequently the value from these hidden form fields was entered into the database.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> ElapsedTimeLogger = function(dateElementId, elapsedElementId, interval) { var container = $(elapsedElementId); var time = parseDate($(dateElementId).text()); var interval = interval; var timer; function parseDate(dateString) { var date = new Date(dateString); return date.getTime(); } function update() { var systemTime = new Date().getTime(); elapsedTime = systemTime - time; container.html(prettyPrintTime(Math.floor(elapsedTime / 1000)));
Additional Information: Each entry in the table has a UNIQUE FORM like this. I put a hidden field in the form so that each of the TIME RECORDING RECORDING RECORDS can be saved in the value as shown below.
<?php echo'<form action="'.$_SERVER['PHP_SELF'].'" method="post" id="form'.$formid.'">';?> <input name="Num" type="hidden" value="<?php echo $results['Time of Call']; ?>" /> **<input type="hidden" name="stoppedtime" id="stoppedtime<?php echo $stopid; ?>" value="">** .....
It would be very appreciated if you could help me with this, thanks!
EDIT:
function update(id) { var systemTime = new Date().getTime(); elapsedTime = systemTime - time; container.html(prettyPrintTime(Math.floor(elapsedTime / 1000)));
source share