-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
137 lines (126 loc) · 4.17 KB
/
index.php
File metadata and controls
137 lines (126 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap-clockpicker.min.css">
<link rel="stylesheet" type="text/css" href="css/github.min.css">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-clockpicker.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>
<title>To Do List</title>
</head>
<style>
#listnya {
font-size:30px;
}
</style>
<body>
<div class="jumbotron jumbotron-fluid">
<div class="container">
<h1 class="display-4">To Do List</h1>
<p class="lead">Input Agendamu Hari Ini</p>
</div>
</div>
<div class="container mt-5">
<form action='<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>' method='post'>
<div class="row">
<div class="col-md-12">
<input type="text" name="kegiatan" class="form-control" placeholder="Masukkan Aktivitas" required>
</div>
</div>
<br>
<div class="row">
<div class="col-sm-3 mt-2">
<input id="input-a" name="waktu" class="form-control" placeholder="Masukkan Waktu" autocomplete="off" required>
</div>
<div class="col-sm-3 mt-2">
<select name="siangmalam" id="" class="form-control">
<option value="AM">AM</option>
<option value="PM">PM</option>
</select>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<button type="submit" class="btn btn-primary mt-3">Submit</button>
</div>
</div>
</form>
<hr>
<div class="table-hover " id="screen">
</div>
<?php
include "koneksi.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST['kegiatan']) || empty($_POST['waktu']) || empty($_POST['siangmalam'])) {
echo "";
} else {
// value
$kegiatan = mysqli_real_escape_string($conn, $_POST['kegiatan']);
$waktu = mysqli_real_escape_string($conn, $_POST['waktu']);
$sm = mysqli_real_escape_string($conn, $_POST['siangmalam']);
$w = $waktu." ".$sm;
$query = "INSERT INTO list VALUES ('','$kegiatan','$w',NOW())";
$result = mysqli_query($conn, $query);
if (!$result) {
?>
<script>
Swal.fire({
type: 'error',
title: 'Adah yang salah nih gan!',
text: 'List gagal ditambahkan :('
})
</script>
<?php
} else {
?>
<script>
Swal.fire({
type: 'success',
title: 'List di Tambah!',
text: 'Tetap Semangat :)'
})
</script>
<?php
}
}
}
?>
<script>
$(document).ready(function(){
setInterval(function(){
$("#screen").load('tampil.php')
}, 2000);
});
</script>
<script>
var input = $('#input-a');
input.clockpicker({
autoclose: true
});
// Manual operations
$('#button-a').click(function(e){
// Have to stop propagation here
e.stopPropagation();
input.clockpicker('show')
.clockpicker('toggleView', 'minutes');
});
$('#button-b').click(function(e){
// Have to stop propagation here
e.stopPropagation();
input.clockpicker('show')
.clockpicker('toggleView', 'hours');
});
</script>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<!-- <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>