1 | <div id="saving">
|
---|
2 | <script type="text/javascript">
|
---|
3 |
|
---|
4 |
|
---|
5 |
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 |
|
---|
11 | $(document).ready(function(){
|
---|
12 | // for fupdate
|
---|
13 | var currentDate2 = new Date();
|
---|
14 | var day2 = currentDate2.getDate();
|
---|
15 | var month2 = currentDate2.getMonth() + 1;
|
---|
16 | var year2 = currentDate2.getFullYear();
|
---|
17 | var fullday2=day2+'-'+month2+'-'+year2;
|
---|
18 |
|
---|
19 | var day;
|
---|
20 | var month;
|
---|
21 | var year;
|
---|
22 | var fullday;
|
---|
23 | <?php
|
---|
24 | if($_GET['day'] || $_GET['month'] || $_GET['year']){
|
---|
25 |
|
---|
26 | ?>
|
---|
27 |
|
---|
28 | day = <?php echo $_GET['day']; ?>;
|
---|
29 | month = <?php echo $_GET['month']; ?>;
|
---|
30 | year = <?php echo $_GET['year']; ?>;
|
---|
31 | fullday=day+'-'+month+'-'+year;
|
---|
32 |
|
---|
33 |
|
---|
34 |
|
---|
35 | <?php
|
---|
36 |
|
---|
37 |
|
---|
38 | }else{
|
---|
39 |
|
---|
40 | ?>
|
---|
41 | var currentDate = new Date();
|
---|
42 | day = currentDate.getDate();
|
---|
43 | month = currentDate.getMonth() + 1;
|
---|
44 | year = currentDate.getFullYear();
|
---|
45 | fullday=day+'-'+month+'-'+year;
|
---|
46 | <?php } ?>
|
---|
47 |
|
---|
48 | <?php
|
---|
49 |
|
---|
50 |
|
---|
51 |
|
---|
52 | $cntsource=mysql_query("SELECT COUNT(*) as `SourceID` FROM source");
|
---|
53 | $rowcnt=mysql_fetch_array($cntsource);
|
---|
54 | $Total= $rowcnt['SourceID'];
|
---|
55 | ?>
|
---|
56 | $('#save').click(function(){
|
---|
57 |
|
---|
58 | <?php $get = $_GET['time']; ?>
|
---|
59 |
|
---|
60 | alert('<?php echo $get; ?>');
|
---|
61 |
|
---|
62 | var InputValue = [];
|
---|
63 | var selectedSource = [];
|
---|
64 | var selectedTime = [];
|
---|
65 | var selectedMeasurement = [];
|
---|
66 | var Time;
|
---|
67 | var Source;
|
---|
68 | var measure;
|
---|
69 | var value;
|
---|
70 | var checks = 0;
|
---|
71 | for(var i=1;i <= cnt;i++)
|
---|
72 | {
|
---|
73 | if($('#Time'+i).val() != '')
|
---|
74 | {
|
---|
75 | Time=$('#Time'+i).val();
|
---|
76 | Source=$('select[id="source'+i+'"]').val();
|
---|
77 | measure=$('select[id="measurement'+i+'"]').val();
|
---|
78 | value=$('#txtData'+i).val();
|
---|
79 | selectedMeasurement.push(measure);
|
---|
80 | selectedSource.push(Source);
|
---|
81 | selectedTime.push(Time);
|
---|
82 | InputValue.push(value);
|
---|
83 |
|
---|
84 | }else{
|
---|
85 | checks++;
|
---|
86 |
|
---|
87 | }
|
---|
88 | }
|
---|
89 |
|
---|
90 | if(checks == 0){
|
---|
91 | //window.location = 'Transaction/insert.php?Time='+selectedTime+'&Source='+selectedSource+'&measure='+selectedMeasurement+'&Data='+InputValue+'&Date='+fullday+'&Date2='+fullday2;
|
---|
92 | }else{
|
---|
93 |
|
---|
94 | alert("Please fill all the details!");
|
---|
95 | }
|
---|
96 | });
|
---|
97 |
|
---|
98 | });
|
---|
99 | </script>
|
---|
100 | </div> |
---|