source: schedule/function/function.php@ 16688

Last change on this file since 16688 was 16688, checked in by tanio, 11 years ago
File size: 1.2 KB
Line 
1 <div id="saving">
2
3 <script type="text/javascript">
4
5
6
7
8
9
10
11
12 $(document).ready(function GetDate(){
13 // for fupdate
14
15
16
17
18
19
20 <?php
21
22
23
24 $cntsource=mysql_query("SELECT COUNT(*) as `SourceID` FROM source");
25 $rowcnt=mysql_fetch_array($cntsource);
26 $Total= $rowcnt['SourceID'];
27 ?>
28 $('#save').click(function(){
29
30
31 var InputValue = [];
32 var selectedSource = [];
33 var selectedTime = [];
34 var selectedMeasurement = [];
35 var Time;
36 var Source;
37 var measure;
38 var value;
39 var checks = 0;
40 for(var i=1;i <= cnt;i++)
41 {
42 if($('#Time'+i).val() != '')
43 {
44 Time=$('#Time'+i).val();
45 Source=$('select[id="source'+i+'"]').val();
46 measure=$('select[id="measurement'+i+'"]').val();
47 value=$('#txtData'+i).val();
48 selectedMeasurement.push(measure);
49 selectedSource.push(Source);
50 selectedTime.push(Time);
51 InputValue.push(value);
52
53 }else{
54 checks++;
55
56 }
57 }
58
59 if(checks == 0){
60 window.location = 'Transaction/insert.php?Time='+selectedTime+'&Source='+selectedSource+'&measure='+selectedMeasurement+'&Data='+InputValue+'&Date='+day+'-'+month+'-'+year;
61 }else{
62
63 alert("Please fill all the details!");
64 }
65 });
66
67 });
68 </script>
69 </div>
Note: See TracBrowser for help on using the repository browser.