sinaps1
sinaps1

Reputation: 57

How to store data from a stopwatch javascript to MySQL

I have a java stopwatch script and I really don't remember where I get it.

This script works fine, but what I need is when the stop button is pressed or the start button is pressed to store the data in the MySQL.

The Javascript is here: http://landingpage.al/script.js

The purpose of this is that I will have some user that will do different things on a work space and on each state of the work their work time will be calculated and stored.

So if anyone have a better idea will be helpful.

The actual php timer is here: http://landingpage.al/articolo100.php

Upvotes: 0

Views: 1468

Answers (1)

user986959
user986959

Reputation: 630

Form:

<div id="main">
<form name="input" id="myform" action="here.php" method="post">
<button type="button" id="1" name="fillo" onclick="ss();start()">Start</button>
<button type="button" id="2" name="mbaro" onclick="ss();start()" onfocus="this.blur()">Stop</button>
<input type="text" id="disp" name="koha"> <br>
</form>

Script:

<script>
function start(){
document.getElementById("myform").submit();
}
</script>

PHP for here.php:

<?php
echo $_POST['koha']; //Use the update command instead of echo
?>

Upvotes: 1

Related Questions