-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathupdate.php
94 lines (83 loc) · 2.51 KB
/
update.php
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
<?php
require 'func.php';
//ambil data di url
$kodetugas = $_GET["Kode_tugas"];
//query data berdasarkan id
$tgs = query("SELECT * FROM tugas WHERE Kode_tugas = $kodetugas")[0];
//cek apakah tombol submit sudah ditekan atau blm
if( isset($_POST["submit"]) ) {
// cek keberhasilan menambah data
if ( update($_POST) > 0) {
echo "
<script>
alert('success update new data');
document.location.href = 'todolist.php';
</script>
";
} else {
echo mysqli_error($conn);
}
// var_dump($_POST);
}
?>
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="css/styleupdate.css">
<head>
<title>Update || To Do List Gopher</title>
</head>
<body>
<div class="topbar">
<div class="isitopbar">
<a href="dashboard.php?npm=<?= $npm ?>"><img src="img/logoweb.png" alt="logoweb"></a>
</div>
<a href="login.php">
<div class="logout">Logout</div>
</a>
<div class="navigasi">
<ul>
<li><a href="dashboard.php?npm=<?= $npm ?>">Dashboard</a></li>
<li><a href="profile.php?npm=<?= $npm ?>">Profile</a></li>
<li><a href="todolist.php?npm=<?= $npm ?>">ToDoList</a></li>
<li><a href="matkul.php?npm=<?= $npm ?>">Matkul</a></li>
</ul>
</div>
</div>
<div class="konten">
<h1>Update List</h1>
<form class="form" action="" method="post">
<input type="hidden" name="Kode_tugas" value="<?= $tgs["Kode_tugas"]; ?>">
<ul>
<li type="none">
<label for="Matkul">Mata Kuliah : </label>
<input type="text" name="Matkul" id="Matkul
"required value="<?= $tgs["Matkul"] ?>">
</li>
<br>
<li type="none">
<label for="Deadline">Deadline : </label>
<input type="date" name="Deadline" id="Deadline"
required value="<?= $tgs["Deadline"] ?>">
</li>
<br>
<li type="none">
<label for="Deskripsi">Deskripsi : </label>
<input type="text" name="Deskripsi" id="Deskripsi" value="<?= $tgs["Deskripsi"] ?>">
</li>
<br>
<li type="none">
<label for="Kode_kelas">Kode Kelas : </label>
<input type="text" name="Kode_kelas" id="Kode_kelas" value="<?= $tgs["Kode_kelas"] ?>">
</li>
<br>
<li type="none">
<button type="submit" name="submit"> +Update </button>
</li>
</ul>
</form>
<div class="back">
<a href="todolist.php"> Back</a>
</div>
</div>
</body>
</html>